zoukankan      html  css  js  c++  java
  • 定时器

    微信小程序里的定时器

                clearTimeout(timerName)
                var timerName = setTimeout(function() {
                  that.getParkList()
              }, 3000)

    微信小程序里的循环定时器

    var that = this;
        var times = 0
        let serverCode = this.data.serverCode
        if (e) {
          times = e
        }
        var i = setInterval(function () {
          times++
          if (times >= 5) {
            that.audioPause()
            that.setData({
              color: "#ff6f10",
              disabled: false,
              getCode: "暂无应答,点击重新呼叫",
            })
            clearInterval(i)
          } else if (!that.data.serverCode) { 
            //这里有一个坑,setData的时候,如果想要即时的data数据做判断
            // 是不能使用serverCode来做判断的,因为这个值不是已经动态改变的
            console.log('11707')
            that.audioPause()
            that.setData({
              color: "#ff6f10",
              disabled: false,
              getCode: "服务器未响应,点击重新呼叫",
            })
            clearInterval(i)
          } else {
            that.setData({
              getCode: "正在呼叫管理员..." + times + "s",
              color: "#999",
              disabled: true
            })
          }
        }, 1000)

     vue里的定时器

      // mounted() {
      //   this.timer = setTimeout(() => {
      //     //在这里实现事件
      //   }, 5000)
      // },
      // beforeDestroy() {
      //   clearTimeout(this.timer)
      // },
    君不见,高堂明镜悲白发,朝如青丝暮成雪
  • 相关阅读:
    sql server 阻塞与锁
    JVM监控
    Java性能分析之线程栈详解与性能分析
    MySQL监控调优
    JVM(上)
    性能测试流程介绍
    性能测试分析调优思路
    监控分析——Web中间件
    Linux性能测试工具安装全集
    Java基础(二十)集合(2)Collection接口
  • 原文地址:https://www.cnblogs.com/lzhflzjx/p/13517518.html
Copyright © 2011-2022 走看看