zoukankan      html  css  js  c++  java
  • 长按功能实现

    以下代码是在vue中开发的

    变量:

    longClick: 0,  // 长按标志
    timeOutEvent: 0,  // 计时器

    方法:

    start () {
          console.log('++++++++++start++++++++++++')
          var that = this;
          this.longClick = 0;  // 初始化
          this.timeOutEvent = setTimeout(function () {
            that.longClick = 1;  //  长按标志位
            // 此处为长按事件
            console.log('长按事件')
            // 生成画布并下载到本地
            that.createPoster()
          }, 500)
        },
        move (e) {
          clearTimeout(this.timeOutEvent);  // 清除计时器 
          this.timeOutEvent = 0;  // 清除标志位
          e.preventDefault();  // 阻止其他点击事件
        },
        end () {
          console.log('++++++++++end++++++++++++')
          clearTimeout(this.timeOutEvent);  // 清除计时器
          if (this.timeOutEvent != 0 && this.longClick == 0) {  // 判断是否非长按事件
            //此处为点击事件
            console.log('点击事件')
          }
          return false;
        },
  • 相关阅读:
    paper:Exploiting Query Reformulations for Web Search Result Diversification
    Z3
    IDA pro 类型参考
    Angr包含什么
    Gcc编译选项
    Angr
    一张图系列之PLT-GOT
    ELF头文件
    BROP_轮子
    Pwn_
  • 原文地址:https://www.cnblogs.com/meiyanstar/p/15067114.html
Copyright © 2011-2022 走看看