vue笔记

//vue防止冒泡
event.stopPropagation();

//vue 的 :class
http://www.cnblogs.com/cina33blogs/p/6738038.html


//vue的unwatch DEMO 滚动刷新数据 items为请求后台的数据,页面做的轮询
self.unwatch = self.$watch('items', function (newValue, oldValue) {
var count = 0;
if(newValue.length!=oldValue.length){
count++;
}
if(count!=0&&document.getElementById('myData')){
this.$nextTick(() => {
var container = this.$el.querySelector("#myData");
container.scrollTop = container.scrollHeight;
});
// document.getElementById('myData').scrollTop = 0;//前面数据刷新
}
});

//vue的interval

this.handle = setInterval(() => {
},8000);
,beforeDestroy(){
clearInterval(this.handle);
}


 
原文地址:https://www.cnblogs.com/susuhyc/p/6958566.html