标签:port slist rom span clear ram set status div
import * as electron from "@/api/serverData/getServerData"; methods:{ electron(){ //请求接口数据 var that = this; let _data = { couponStatus : that.$route.params.status, mealType : that.$route.params.type } electron.setCouponStatusList(_data).then(res => { //console.log(res) that.voucherList = res.data.coupon; } }, mounted() { this.electron(); timer = setInterval(this.electron, 5000); //每隔5000毫秒请求一次接口 }, destroyed () { clearInterval(timer); //清除定时器 }
清除每隔5000毫秒请求一次接口的定时器(需求:每当我手动核销电子码,页面上的显示数据要实时更新到)
标签:port slist rom span clear ram set status div
原文地址:https://www.cnblogs.com/cocoxia/p/9098689.html