zoukankan      html  css  js  c++  java
  • 移动端使用fastclick 解决

    html

    vue

    1. cnpm i fastclick --save

    2. 在main.js中引入并绑定到body

         import fastclick from 'fastclick';

    3. fastclick.attach(document.body);

    react

    1. Install

    npm install --save-dev react-fastclick-alt

    2. 用法

    将元素或者component放在  <FastClick>...</FastClick> 中

    3. 监测到tap事件后会阻止冒泡  event.stopPropagation()

    import React from 'react';

    import FastClick from 'react-fastclick-alt';
    import ReactDOM from 'react-dom';
    ReactDOM.render(<FastClick><MyApp/></FastClick>, document.getElementById('app'));

    4. 两个参数  

      threshold    在px中不能再转换为点击之前,触摸可以移动多远。 默认为15px。

      timeThreshold   在不能再将点击转换为点击之前可以持续点击多长时间,以毫秒为单位。 默认为125毫秒。

  • 相关阅读:
    Pyhton学习——Day60
    Pyhton学习——Day58
    Python——微信数据分析
    C/C++文件指针偏移
    I/O流+统计文件词频
    vector概念
    new/delete工作机制
    Singleton单例类模式
    对象数组
    特殊成员函数
  • 原文地址:https://www.cnblogs.com/wrhbk/p/11490874.html
Copyright © 2011-2022 走看看