[new feature] CellSwipe support async controll (#356)

* fix: Tabbar icon line-height

* [new feature] progress add showPivot prop

* [new feature] TabItem support vue-router

* [new feature] update document header style

* [Doc] add toast english ducoment

* [bugfix] Search box-sizing wrong

* [Doc] update vant-demo respo

* [Doc] translate theme & demo pages

* [Doc] add Internationalization document

* [bugfix] remove unnecessary props

* [fix] optimize clickoutside

* [new feature] optimize find-parent

* [new feature]: change document title accordinng to language

* [new feature] Pagination code review

* [improvement] adjust icon-font unicode

* [improvement] Icon spinner color inherit

* [improvement] icon default width

* [bugfix] DateTimePicker validate date props

* [bugfix] Tab item text ellipsis

* [improvement] optimize single line ellipsis

* [Improvement] optimzie staticClass

* [Improvement] Button: use sfc instread of jsx

* [Improvement] update actionsheet close icon style

* fix: yarn.lock

* fix: icon test cases

* [bugfix] errors during ssr

* [Improvement] SubmitBar add left slot

* [new feature] ImagePreview support manually close

* fix: ImagePreview test case

* [Doc] add switch lang button in mobile

* [bugfix] Popup overlay style update

* [bugfix] NavBar click event

* [Improvement] optimize build speed

* [new feature] CellSwipe support async controll
This commit is contained in:
neverland
2017-11-28 10:14:05 +08:00
committed by GitHub
parent a0acfd9f7f
commit f3e75ccba6
5 changed files with 198 additions and 20 deletions

View File

@@ -1,19 +1,19 @@
<template>
<div
v-clickoutside:touchstart="swipeMove"
v-clickoutside:touchstart="onClick"
class="van-cell-swipe"
@click="swipeMove()"
@click="onClick('cell')"
@touchstart="startDrag"
@touchmove="onDrag"
@touchend="endDrag"
@touchcancel="endDrag"
>
<div class="van-cell-swipe__wrapper" :style="wrapperStyle" @transitionend="swipe = false">
<div class="van-cell-swipe__left" v-if="leftWidth">
<div class="van-cell-swipe__left" @click.stop="onClick('left')" v-if="leftWidth">
<slot name="left"></slot>
</div>
<slot></slot>
<div class="van-cell-swipe__right" v-if="rightWidth">
<div class="van-cell-swipe__right" @click.stop="onClick('right')" v-if="rightWidth">
<slot name="right"></slot>
</div>
</div>
@@ -27,6 +27,7 @@ export default {
name: 'van-cell-swipe',
props: {
onClose: Function,
leftWidth: {
type: Number,
default: 0
@@ -56,6 +57,10 @@ export default {
},
methods: {
close() {
this.offset = 0;
},
resetSwipeStatus() {
this.swiping = false;
this.opened = true;
@@ -115,6 +120,18 @@ export default {
if (this.swiping) {
this.swipeLeaveTransition(this.offset > 0 ? -1 : 1);
};
},
onClick(position = 'outside') {
if (!this.offset) {
return;
}
if (this.onClose) {
this.onClose(position, this);
} else {
this.swipeMove(0);
}
}
}
};