每秒更新时间 v-text的应用 (解决闪现{}问题)

有闪现
<div id="app">
{{date}}
</div>
无闪现
<div id="app" v-text:date="date">
</div>
var app=new Vue({
el: '#app',
data:{
date:new Date()
},
mounted:function(){
var _this=this;
this.timer=setInterval(function(){
_this.date=new Date();
},1000);
},
beforeDestroy:function(){
if(this.timer){
clearInterval(this.timer);
}
}

})
posted @ 2018-03-20 22:32  ThisCall  阅读(163)  评论(0编辑  收藏  举报