vue mounted中监听div的变化

vue mounted中监听div的变化

<div style="width:200px;height:30px;background: #0e90d2" id="list2">00</div>
<div @click="fun" id="list" style="width:200px;height:350px;background:blueviolet">{{$store.state.msg}}</div>



methods: {

fun(){
this.$store.dispatch('fun',this.checkedNames);

},

 

 

mounted(){
document.getElementById('list').addEventListener("DOMSubtreeModified", function(){
var he=document.getElementById('list').offsetHeight;

document.getElementById('list2').style.height=he+'px';
console.log(he);
}, false)
}
posted @ 2018-06-13 17:49  瑞蚨祥qianjin  阅读(855)  评论(0编辑  收藏  举报