使用nexttick
<script>
//树形控件的属性:setCurrentKey
this.$nextTick(() => {
this.$refs.treeList.setCurrentKey(this.comPanyS[0].ID)
});
//监控data中的数据变化
watch: {
//table的数据进行监听
tableStash: function() {
//使用nextTick
this.$nextTick(function() {
//使用table的属性setCurrentRow进行赋值
this.$refs.tableStash.$refs.table.setCurrentRow(this.tableStash[0])
this.Stashrow=this.tableStash[0]
this.getStorage()
})
}
},
</script>