logo
  • 教程列表
  • SO官方文档
  • 阵列变化检测警告
    • 对于嵌套数组
    • 包含数组的对象数组
    • 使用 Vue.set
    • 使用 Array.prototype.splice
  1. StackOverflow 文档
  2. Vue.js 教程
  3. 阵列变化检测警告
  4. 包含数组的对象数组

包含数组的对象数组

Created: November-22, 2018

new Vue({
    el: '#app',
    data:{
        myArr : [
            {
                name: 'object-1',
                nestedArr: ['apple', 'banana']
            },
            {
                name: 'object-2',
                nestedArr: ['grapes', 'orange']
            }
        ]
    },
    methods:{
        changeArrayItem: function(){
            this.$set(this.myArr[1].nestedArr, 1, 'strawberry');
        }
    }
}) 

这是小提琴的链接

  • 使用 Vue.set
  • 对于嵌套数组

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明