1. @vant/touch-emulator
Vant touch emulator
@vant/touch-emulator
Package: @vant/touch-emulator
Created by: vant-ui
Last modified: Wed, 02 Nov 2022 09:39:09 GMT
Version: 1.4.0
License: MIT
Downloads: 9,268
Repository: https://github.com/vant-ui/vant

Install

npm install @vant/touch-emulator
yarn add @vant/touch-emulator

Vant Touch Emulator

在桌面端上模拟移动端 touch 事件,实现方式来自于 hammerjs/touchemulator.

Install

 # with npm
npm i @vant/touch-emulator

# with yarn
yarn add @vant/touch-emulator

# with pnpm
pnpm add @vant/touch-emulator

使用指南

直接在代码中引入模块即可,模块会自动完成初始化并生效

 import '@vant/touch-emulator';

CDN 引入

 <script src="https://fastly.jsdelivr.net/npm/@vant/touch-emulator"></script>

禁用 touch 模拟

在标签上添加 data-no-touch-simulate 属性后,可以使这个标签(以及它的子元素)不触发 touch 模拟事件。

 <div data-no-touch-simulate />

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin