在index.html中添加一下代码
<script
src="https://as.alipayobjects.com/g/component/fastclick/1.0.6/fastclick.js"></scrip
t>
<script>
if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body);
}, false);
}
if(!window.Promise) {
document.writeln('<script
src="https://as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js"
'+'>'+'<'+'/'+'script>');
}
</script>
在main.js中引用
先执行安装fastclick的命令。
npm install fastclick -S
之后,在main.js中引入,并绑定到body。
import FastClick from 'fastclick'
FastClick.attach(document.body);