vue 使用定时器setInterval

来自:https://www.jianshu.com/p/180957762852 侵删

beforeMount() {
//车辆进出设置定时器,每3秒刷新一次 var self = this; clearInterval(timer); let timer = setInterval(_getCarPeopleStreamByEntraceBottom, 3000) function _getCarPeopleStreamByEntraceBottom() { //生成随机数用来测试 let totelNumber = new Array(8); for (let i = 0; i < totelNumber.length; i++) { totelNumber[i] = Math.ceil(Math.random() * 10) - 1 }; let data = { carInNumber: totelNumber[0], carOutNumber: totelNumber[1] }; self.southPassagewayData = data; } _getCarPeopleStreamByEntraceBottom(); },

 

posted @ 2019-01-29 14:34  abcByme  阅读(1202)  评论(0编辑  收藏  举报