[improvement] Actionsheet: add cancel event (#796)

This commit is contained in:
张敏
2018-03-29 11:43:21 +08:00
committed by GitHub
parent 99361427f9
commit 1c2b45503e
5 changed files with 29 additions and 3 deletions
+7 -2
View File
@@ -3,7 +3,7 @@
<div class="van-actionsheet" :class="{ 'van-actionsheet--withtitle': title }" v-show="value">
<div class="van-actionsheet__header van-hairline--top-bottom" v-if="title">
<div v-text="title" />
<icon name="close" @click="$emit('input', false)" />
<icon name="close" @click="handleCancel" />
</div>
<ul v-else class="van-hairline--bottom">
<li
@@ -24,7 +24,7 @@
v-if="cancelText"
v-text="cancelText"
class="van-actionsheet__item van-actionsheet__cancel van-hairline--top"
@click="$emit('input', false)"
@click="handleCancel"
/>
<div v-else class="van-actionsheet__content">
<slot />
@@ -65,6 +65,11 @@ export default create({
if (typeof item.callback === 'function') {
item.callback(item);
}
},
handleCancel() {
this.$emit('input', false);
this.$emit('cancel');
}
}
});