提交 57a0a4ec 编写于 作者: D dolymood

feat(ActionSheet, Dialog, Picker, Toast): support mask-closable

#221
上级 3cf5c16c
...@@ -22,6 +22,10 @@ export default { ...@@ -22,6 +22,10 @@ export default {
default() { default() {
return {} return {}
} }
},
maskClosable: {
type: Boolean,
default: true
} }
}, },
computed: { computed: {
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
:mask="true" :mask="true"
:z-index="zIndex" :z-index="zIndex"
v-show="isVisible" v-show="isVisible"
@touchmove.prevent="noop" @touchmove.prevent
@mask-click="cancel"> @mask-click="maskClick">
<transition name="cube-action-sheet-move"> <transition name="cube-action-sheet-move">
<div class="cube-action-sheet-panel cube-safe-area-pb" v-show="isVisible" @click.stop="noop"> <div class="cube-action-sheet-panel cube-safe-area-pb" v-show="isVisible" @click.stop>
<h1 class="cube-action-sheet-title border-bottom-1px" v-show="pickerStyle || title">{{title}}</h1> <h1 class="cube-action-sheet-title border-bottom-1px" v-show="pickerStyle || title">{{title}}</h1>
<div class="cube-action-sheet-content"> <div class="cube-action-sheet-content">
<ul class="cube-action-sheet-list"> <ul class="cube-action-sheet-list">
...@@ -64,10 +64,15 @@ ...@@ -64,10 +64,15 @@
pickerStyle: { pickerStyle: {
type: Boolean, type: Boolean,
default: false default: false
},
maskClosable: {
type: Boolean,
default: true
} }
}, },
methods: { methods: {
noop() { maskClick() {
this.maskClosable && this.cancel()
}, },
cancel() { cancel() {
this.hide() this.hide()
......
<template> <template>
<transition name="cube-dialog-fade"> <transition name="cube-dialog-fade">
<cube-popup type="dialog" :z-index="zIndex" :mask="true" :center="true" v-show="isVisible"> <cube-popup
type="dialog"
:z-index="zIndex"
:mask="true"
:center="true"
v-show="isVisible"
@mask-click="maskClick"
>
<div class="cube-dialog-main"> <div class="cube-dialog-main">
<span class="cube-dialog-close" v-show="showClose" @click="close"><i class="cubeic-close"></i></span> <span class="cube-dialog-close" v-show="showClose" @click="close"><i class="cubeic-close"></i></span>
<div :class="containerClass"> <div :class="containerClass">
...@@ -122,6 +129,9 @@ ...@@ -122,6 +129,9 @@
} }
}, },
methods: { methods: {
maskClick(e) {
this.maskClosable && this.cancel(e)
},
confirm(e) { confirm(e) {
if (this._confirmBtn.disabled) { if (this._confirmBtn.disabled) {
return return
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:z-index="zIndex" :z-index="zIndex"
v-show="isVisible" v-show="isVisible"
@touchmove.prevent @touchmove.prevent
@mask-click="cancel"> @mask-click="maskClick">
<transition name="cube-picker-move"> <transition name="cube-picker-move">
<div class="cube-picker-panel cube-safe-area-pb" v-show="isVisible" @click.stop> <div class="cube-picker-panel cube-safe-area-pb" v-show="isVisible" @click.stop>
<div class="cube-picker-choose border-bottom-1px"> <div class="cube-picker-choose border-bottom-1px">
...@@ -123,6 +123,9 @@ ...@@ -123,6 +123,9 @@
this.$emit(EVENT_VALUE_CHANGE, this.pickerSelectedVal, this.pickerSelectedIndex, pickerSelectedText) this.$emit(EVENT_VALUE_CHANGE, this.pickerSelectedVal, this.pickerSelectedIndex, pickerSelectedText)
} }
}, },
maskClick() {
this.maskClosable && this.cancel()
},
cancel() { cancel() {
this.hide() this.hide()
this.$emit(EVENT_CANCEL) this.$emit(EVENT_CANCEL)
......
<template> <template>
<transition name="cube-toast-fade"> <transition name="cube-toast-fade">
<cube-popup type="toast" :z-index="zIndex" :mask="mask" v-show="isVisible"> <cube-popup
type="toast"
:z-index="zIndex"
:mask="mask"
v-show="isVisible"
@mask-click="maskClick"
>
<i v-show="!isLoading" class="cube-toast-icon" :class="iconClass"></i> <i v-show="!isLoading" class="cube-toast-icon" :class="iconClass"></i>
<cube-loading v-show="isLoading"></cube-loading> <cube-loading v-show="isLoading"></cube-loading>
<div v-show="txt" class="cube-toast-tip" v-html="txt"></div> <div v-show="txt" class="cube-toast-tip" v-html="txt"></div>
...@@ -69,6 +75,9 @@ ...@@ -69,6 +75,9 @@
} }
}, },
methods: { methods: {
maskClick() {
this.maskClosable && this.hide()
},
show() { show() {
this.isVisible = true this.isVisible = true
this.clearTimer() this.clearTimer()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册