码迷,mamicode.com
首页 > 其他好文 > 详细

清除每隔5000毫秒请求一次接口的定时器(需求:每当我手动核销电子码,页面上的显示数据要实时更新到)

时间:2018-05-28 11:36:05      阅读:194      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!