From 57a0a4ec32e707743792df258b8a526704bc8f20 Mon Sep 17 00:00:00 2001 From: dolymood Date: Wed, 6 Jun 2018 16:12:59 +0800 Subject: [PATCH] feat(ActionSheet, Dialog, Picker, Toast): support mask-closable #221 --- src/common/mixins/basic-picker.js | 4 ++++ src/components/action-sheet/action-sheet.vue | 13 +++++++++---- src/components/dialog/dialog.vue | 12 +++++++++++- src/components/picker/picker.vue | 5 ++++- src/components/toast/toast.vue | 11 ++++++++++- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/common/mixins/basic-picker.js b/src/common/mixins/basic-picker.js index acbd2e9a..a750c08f 100644 --- a/src/common/mixins/basic-picker.js +++ b/src/common/mixins/basic-picker.js @@ -22,6 +22,10 @@ export default { default() { return {} } + }, + maskClosable: { + type: Boolean, + default: true } }, computed: { diff --git a/src/components/action-sheet/action-sheet.vue b/src/components/action-sheet/action-sheet.vue index cb622da2..b8c44782 100644 --- a/src/components/action-sheet/action-sheet.vue +++ b/src/components/action-sheet/action-sheet.vue @@ -7,10 +7,10 @@ :mask="true" :z-index="zIndex" v-show="isVisible" - @touchmove.prevent="noop" - @mask-click="cancel"> + @touchmove.prevent + @mask-click="maskClick"> -
+

{{title}}

    @@ -64,10 +64,15 @@ pickerStyle: { type: Boolean, default: false + }, + maskClosable: { + type: Boolean, + default: true } }, methods: { - noop() { + maskClick() { + this.maskClosable && this.cancel() }, cancel() { this.hide() diff --git a/src/components/dialog/dialog.vue b/src/components/dialog/dialog.vue index 8c243cab..54b15c32 100644 --- a/src/components/dialog/dialog.vue +++ b/src/components/dialog/dialog.vue @@ -1,6 +1,13 @@