加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

vue 使用定时器setInterval

发布时间:2020-12-16 23:14:53 所属栏目:百科 来源:网络整理
导读:div class="cnblogs_code" 来自:https://www.jianshu.com/p/180957762852 侵删 beforeMount() { self = = setInterval(_getCarPeopleStreamByEntraceBottom,3000 /spanspan style="color: #0000ff"gt;function/spanspan style="color: #000000"gt; _getCarP

<div class="cnblogs_code">

来自:https://www.jianshu.com/p/180957762852 侵删beforeMount() {
    
     self = = setInterval(_getCarPeopleStreamByEntraceBottom,3000</span><span style="color: #0000ff"&gt;function</span><span style="color: #000000"&gt; _getCarPeopleStreamByEntraceBottom() {
    </span><span style="color: #008000"&gt;//</span><span style="color: #008000"&gt;生成随机数用来测试</span>
    let totelNumber = <span style="color: #0000ff"&gt;new</span> Array(8<span style="color: #000000"&gt;);
    </span><span style="color: #0000ff"&gt;for</span> (let i = 0; i < totelNumber.length; i++<span style="color: #000000"&gt;) {
        totelNumber[i] </span>= Math.ceil(Math.random() * 10) - 1<span style="color: #000000"&gt;
    };

    let data </span>=<span style="color: #000000"&gt; {
        carInNumber: totelNumber[</span>0<span style="color: #000000"&gt;],carOutNumber: totelNumber[</span>1<span style="color: #000000"&gt;]
    };
    self.southPassagewayData </span>=<span style="color: #000000"&gt; data;
}
_getCarPeopleStreamByEntraceBottom();

},

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读