in template
<li v-for="item in items">
<p class="time"><span>{{ item.timer }}</span>
<div class="main self">
<img class="avatar" src="@/assets/img/2.jpg" alt="" />
<div class="text">
{{ item.label }}
</div>
</div>
</li>
in data
timer: "",
items: [],
newItem: "",
in methods
seed() {
if(this.$refs.textarea.value === "") {
this.$Message.error("");
} else {
var date = new Date();
var hour = date.getHours(); //
var minute = date.getMinutes(); //
var second = date.getSeconds(); //
if(hour < 10 ) {
hour = "0" + hour
}
if(minute < 10){
minute = "0" + minute
}
if(second < 10){
second = "0" + second
}
this.timer = hour + ":" + minute + ":" + second;
this.items.push({
label: this.newItem,
isFinished: false,
timer: this.timer
})
this.newItem = "";
}
}
the problem now is: the time will be displayed every time you click to send, but I want to show the time every three minutes. How to solve it