在IE上也是可以的。
HTML部分:
<div class="time">{{date}}</div>
方法部分:
export default {
name: 'test',
data: function() {
return {
date: new Date(),
};
},
created() {
},
mounted() {
let that= this;
this.timer = setInterval(function() {
that.date = new Date().toLocaleString();
});
},
beforeDestroy: function() {
if (this.timer) {
clearInterval(this.timer);
}
},
methods: {
}
};