// 先添加ref
<dv-scroll-board :config="config" ref="scrollBoard" style="width:100%;height:100%;"/>
config: {
data: []
},
configStyle: {
rowNum: 8,
oddRowBGC: '',
evenRowBGC: 'rgba(2, 217, 253, 0.3)'
}
watch: {
controlObj: {
handler(val) {
const data = []
this.controlObj.exportList.forEach(item => {
const i = []
i.push(item.log)
data.push(i)
})
if (this.config.data.length > 0) {
this.$refs['scrollBoard'].updateRows(data);
} else {
this.config = {data: data}
this.config = {...this.config, ...this.configStyle}
}
},
deep: true,
immediate: true
}
}