created() {
// 设置定时器,5s执行一次
this.timer = setInterval(() => {
this.getData()
//这个是我在mounted(){}中写的一个方法,从后端拿到数据并返回给前端页面
}, 5000);
},
mounted() {
this.getData();
},
Vue计时器的使用
最新推荐文章于 2024-06-19 09:49:44 发布
created() {
// 设置定时器,5s执行一次
this.timer = setInterval(() => {
this.getData()
//这个是我在mounted(){}中写的一个方法,从后端拿到数据并返回给前端页面
}, 5000);
},
mounted() {
this.getData();
},