[new feature] toast add mask option (#296)

* [bugfix] CouponList always show empty info

* [bugfix] add click feedback of buttons in components

* [Doc] add custom theme document

* [new feature] Notice bar support more props

* [bugfix] PullRefresh test cases

* [bugfix] unused NoticeBar style

* [bugfix] Swipe width calc error

* [Doc] english document of all action components

* [Doc] change document site path to /zanui/vant

* [Doc] fix

* [bugfix] uploader style error

* [bugfix] tabs document demo

* [new feature] Cell support vue-router target route

* [bugfix] add cell test cases

* update yarn.lock

* [bugfix] Tabbar cann't display info when use icon slot

* [Doc] update document title

* [bugfix] Dialog should reset button text when showed

* [new feature] CouponList add showCloseButton prop

* [new feature] Swipe add 'initialSwipe' prop

* [bugfix] NoticeBar text disappeared when page back

* [new feature] ImagePreview support startPosition

* fix: improve imagePreview test cases

* [bugfix] Steps style error when has more than 4 items

* [new feature] normalize size of all icons

* [new feature] Stepper add plus & minus event

* fix: yarn.lock

* [bugfix] addressEdit icon render failed

* [new feature] toast add mask option
This commit is contained in:
neverland 2017-11-09 01:08:46 -06:00 committed by GitHub
parent 3d19ddb573
commit 257654ff03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 8 deletions

View File

@ -7,7 +7,7 @@ export default {
Toast('我是提示文案,建议不超过十五字~'); Toast('我是提示文案,建议不超过十五字~');
}, },
showLoadingToast() { showLoadingToast() {
Toast.loading(); Toast.loading({ mask: true });
}, },
showSuccessToast() { showSuccessToast() {
Toast.success('成功文案'); Toast.success('成功文案');
@ -76,7 +76,7 @@ export default {
export default { export default {
methods: { methods: {
showLoadingToast() { showLoadingToast() {
Toast.loading(); Toast.loading({ mask: true });
} }
} }
} }
@ -109,7 +109,7 @@ export default {
:::demo Advanced Usage :::demo Advanced Usage
```html ```html
<van-button @click="showCustomizedToast">#### Advanced Usage</van-button> <van-button @click="showCustomizedToast">Advanced Usage</van-button>
``` ```
```javascript ```javascript
@ -154,5 +154,7 @@ export default {
|-----------|-----------|-----------|-------------|-------------| |-----------|-----------|-----------|-------------|-------------|
| type | 提示类型 | `String` | `text` | `loading` `success` `fail` `html` | | type | 提示类型 | `String` | `text` | `loading` `success` `fail` `html` |
| message | 内容 | `String` | `''` | - | | message | 内容 | `String` | `''` | - |
| position | 位置 | `String` | `middle` | `top` `bottom` |
| mask | 是否显示背景蒙层 | `Boolean` | `false` | - |
| forbidClick | 禁止背景点击 | `Boolean` | `false` | - | | forbidClick | 禁止背景点击 | `Boolean` | `false` | - |
| duration | 时长(ms) | `Number` | `3000` | 值为 0 时toast 不会消失 | | duration | 时长(ms) | `Number` | `3000` | 值为 0 时toast 不会消失 |

View File

@ -15,7 +15,7 @@ export default {
Toast('我是提示文案,建议不超过十五字~'); Toast('我是提示文案,建议不超过十五字~');
}, },
showLoadingToast() { showLoadingToast() {
Toast.loading(); Toast.loading({ mask: true });
}, },
showSuccessToast() { showSuccessToast() {
Toast.success('成功文案'); Toast.success('成功文案');
@ -84,7 +84,7 @@ export default {
export default { export default {
methods: { methods: {
showLoadingToast() { showLoadingToast() {
Toast.loading(); Toast.loading({ mask: true });
} }
} }
} }
@ -163,5 +163,6 @@ export default {
| type | 提示类型 | `String` | `text` | `loading` `success` `fail` `html` | | type | 提示类型 | `String` | `text` | `loading` `success` `fail` `html` |
| message | 内容 | `String` | `''` | - | | message | 内容 | `String` | `''` | - |
| position | 位置 | `String` | `middle` | `top` `bottom` | | position | 位置 | `String` | `middle` | `top` `bottom` |
| mask | 是否显示背景蒙层 | `Boolean` | `false` | - |
| forbidClick | 禁止背景点击 | `Boolean` | `false` | - | | forbidClick | 禁止背景点击 | `Boolean` | `false` | - |
| duration | 时长(ms) | `Number` | `3000` | 值为 0 时toast 不会消失 | | duration | 时长(ms) | `Number` | `3000` | 值为 0 时toast 不会消失 |

View File

@ -8,6 +8,7 @@ const defaultOptions = {
type: 'text', type: 'text',
position: 'middle', position: 'middle',
duration: 3000, duration: 3000,
mask: false,
forbidClick: false, forbidClick: false,
clear: () => { clear: () => {
instance.visible = false; instance.visible = false;

View File

@ -13,7 +13,7 @@
<div v-if="message" class="van-toast__text">{{ message }}</div> <div v-if="message" class="van-toast__text">{{ message }}</div>
</template> </template>
</div> </div>
<div class="van-toast__overlay" v-if="forbidClick" /> <div :class="['van-toast__overlay', { 'van-toast__overlay--mask': mask }]" v-if="forbidClick || mask" />
</div> </div>
</transition> </transition>
</template> </template>
@ -50,6 +50,10 @@ export default {
position: { position: {
type: String, type: String,
default: 'middle' default: 'middle'
},
mask: {
type: Boolean,
default: false
} }
}, },

View File

@ -28,7 +28,11 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 3000; z-index: 3000;
background: transparent; background-color: transparent;
&--mask {
background-color: rgba(0, 0, 0, .5);
}
} }
&--text { &--text {