vue watch中使用this.$refs.tableRef.doLayout()为什么要放在this.$nextTick中才会有作用?
watch: {
// el-table绑定的data
tableData: {
handler() {
this.$nextTick(() => {
this.$refs.tableRef.doLayout()
})
},
deep: true,
}
},
因为数据从无到有,dom也一样从无到有,所以要等待render之后才能获取到啊