$nextTick这个方法的意思大概就是数据更新后触发dom节点更新吧,数据多层的时候vue监听不到底层的数据变化,可以使用watch方法深度监听数据的变化,然后使用$nextTick在数据变化后触发dom节点更新,并且数据获取到后要遍历数据放进定义的数组里不然也不会出发dom节点更新

$.each(data.resultData,function (index,item) {
              item.showChild = false;
              self.tableData.push(item)
            })
showDetail(item){
            console.log(this.tableData)
            console.log(item)
            this.$nextTick(function () {
              item.showChild = !item.showChild
            })
          },
watch:{
          tableData:{
            handler:function(val,oldVal){
              this.tableData = val;
            },
            // 深度观察
            deep:true
          }
        },

 

相关文章:

  • 2022-01-13
  • 2021-10-29
  • 2021-08-06
  • 2021-09-21
  • 2021-09-18
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-02
  • 2022-12-23
  • 2021-06-10
  • 2021-04-26
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
相关资源
相似解决方案