watch: { totalCount (newValue, oldValue) { this.totalCount1 = newValue }, loading (newValue, oldValue) { this.loading1 = newValue }, sceneClassList: { // 注意監聽的時候不要漏掉空數據的情況 handler(newValue, oldValue) { console.log('newValue', newValue) if (newValue.length) { //監聽有數據的情況 for (let i = 0; i < newValue.length; i++) { if (oldValue[i] != newValue[i]) { console.log('this.sceneClassList', this.sceneClassList) this.sceneClassList1 = this.sceneClassList this.$nextTick(function() { this.heightOfDl = this.$refs.dlHeight.offsetHeight + 'px' this.$emit('updateHeightOfDl', this.heightOfDl) }) } } } else { // 監聽空數據的情況 this.sceneClassList1 = [] this.$nextTick(function() { this.heightOfDl = this.$refs.dlHeight.offsetHeight + 'px' this.$emit('updateHeightOfDl', this.heightOfDl) }) } }, deep: true } }