@vant/touch-emulator
Advanced tools
Comparing version 1.3.0 to 1.3.1
# Changelog | ||
### [v1.3.1] | ||
`2021-07-06` | ||
- support data-no-touch-simulate attr | ||
### [v1.3.0] | ||
`2021-05-26` | ||
- add SSR support [\#8767](https://github.com/youzan/vant/pull/8767) | ||
### [v1.2.0] | ||
`2019-11-22` | ||
- fix incorrect touchmove behaviour in Firefox [\#5118](https://github.com/youzan/vant/pull/5118) | ||
- fix incorrect touchmove behavior in Firefox | ||
### [v1.1.0] | ||
`2019-06-03` | ||
@@ -14,4 +28,5 @@ | ||
### [v1.0.0] | ||
`2019-05-28` | ||
- initial release |
17
index.js
@@ -54,2 +54,15 @@ /* eslint-disable */ | ||
if (!Element.prototype.closest) { | ||
Element.prototype.closest = function (s) { | ||
var el = this; | ||
do { | ||
if (el.matches(s)) return el; | ||
el = el.parentElement || el.parentNode; | ||
} while (el !== null && el.nodeType === 1); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -134,3 +147,5 @@ * create an touch point | ||
triggerTouch(touchType, ev); | ||
if (eventTarget.closest('[data-no-touch-simulate]') == null) { | ||
triggerTouch(touchType, ev); | ||
} | ||
@@ -137,0 +152,0 @@ // reset |
{ | ||
"name": "@vant/touch-emulator", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Vant touch emulator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,1 +32,9 @@ # Vant Touch Emulator | ||
``` | ||
## 禁用 touch 模拟 | ||
在标签上添加 `data-no-touch-simulate` 属性后,可以使这个标签(以及它的子元素)不触发 `touch` 模拟事件。 | ||
```html | ||
<div data-no-touch-simulate /> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6423
187
40