fix: swipe sometimes will change to drag image (#81)

* swipe forbid dragstart
This commit is contained in:
Yao 2017-08-19 12:27:05 +08:00 committed by GitHub
parent f151a1cb46
commit 893a192056
3 changed files with 30 additions and 0 deletions

View File

@ -64,6 +64,33 @@ export default {
```
:::
#### 隐藏指示器
需要设置`show-indicators`属性为`false`,即会隐藏指示器。
:::demo 隐藏指示器
```html
<van-swipe :show-indicators="false">
<van-swipe-item v-for="(img, index) in autoImages" :key="index">
<img v-lazy="img" alt="">
</van-swipe-item>
</van-swipe>
<script>
export default {
data() {
return {
autoImages: [
'https://img.yzcdn.cn/upload_files/2017/03/09/FvkZahKoq1vkxLQFdVWeLf2UCqDz.png',
'https://img.yzcdn.cn/upload_files/2017/03/09/Fk0rpe_svu9d5Xk3MUCWd1QeMXOu.png'
]
};
}
};
</script>
```
:::
#### 自动轮播
需要设置`auto-play`属性为`true`,即会自动轮播。

View File

@ -73,6 +73,8 @@
"friendly-errors-webpack-plugin": "^1.6.1",
"gh-pages": "^1.0.0",
"gulp": "^3.9.1",
"gulp-cssmin": "^0.2.0",
"gulp-postcss": "^7.0.0",
"gulp-util": "^3.0.8",
"highlight.js": "^9.12.0",
"html-webpack-plugin": "^2.29.0",

View File

@ -26,6 +26,7 @@ Input.prototype = Object.create(new EventEmitter());
extend(Input.prototype, {
bind: function(host) {
if (Vue.prototype.$isServer) return;
bindEvents(host, 'dragstart', e => e.preventDefault());
bindEvents(host, 'touchstart mousedown', this.onTouchStart);
if (this.options.listenMoving) {
bindEvents(window, 'touchmove mousemove', this.onTouchMove);