vue 使用定時器setInterval
阿新 • • 發佈:2019-01-29
cti fun mount bottom thp tps num math tom
來自: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(); },
vue 使用定時器setInterval