移动端使用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 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毫秒。

浙公网安备 33010602011771号