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);
}


 

posted on 2017-06-07 18:37  miu丶苏  阅读(183)  评论(0编辑  收藏  举报

导航