パッケージの詳細

@vant/touch-emulator

vant-ui15.6kMIT1.4.0

Vant touch emulator

readme

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 />

更新履歴

Changelog

[v1.4.0]

2022-08-06

  • support .mjs extension

[v1.3.1]

2021-07-06

  • support data-no-touch-simulate attr

[v1.3.0]

2021-05-26

[v1.2.0]

2019-11-22

  • fix incorrect touchmove behavior in Firefox

[v1.1.0]

2019-06-03

  • skip emulator when browser support touch event

[v1.0.0]

2019-05-28

  • initial release