mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[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:
parent
3d19ddb573
commit
257654ff03
@ -7,7 +7,7 @@ export default {
|
||||
Toast('我是提示文案,建议不超过十五字~');
|
||||
},
|
||||
showLoadingToast() {
|
||||
Toast.loading();
|
||||
Toast.loading({ mask: true });
|
||||
},
|
||||
showSuccessToast() {
|
||||
Toast.success('成功文案');
|
||||
@ -76,7 +76,7 @@ export default {
|
||||
export default {
|
||||
methods: {
|
||||
showLoadingToast() {
|
||||
Toast.loading();
|
||||
Toast.loading({ mask: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ export default {
|
||||
|
||||
:::demo Advanced Usage
|
||||
```html
|
||||
<van-button @click="showCustomizedToast">#### Advanced Usage</van-button>
|
||||
<van-button @click="showCustomizedToast">Advanced Usage</van-button>
|
||||
```
|
||||
|
||||
```javascript
|
||||
@ -154,5 +154,7 @@ export default {
|
||||
|-----------|-----------|-----------|-------------|-------------|
|
||||
| type | 提示类型 | `String` | `text` | `loading` `success` `fail` `html` |
|
||||
| message | 内容 | `String` | `''` | - |
|
||||
| position | 位置 | `String` | `middle` | `top` `bottom` |
|
||||
| mask | 是否显示背景蒙层 | `Boolean` | `false` | - |
|
||||
| forbidClick | 禁止背景点击 | `Boolean` | `false` | - |
|
||||
| duration | 时长(ms) | `Number` | `3000` | 值为 0 时,toast 不会消失 |
|
||||
|
@ -15,7 +15,7 @@ export default {
|
||||
Toast('我是提示文案,建议不超过十五字~');
|
||||
},
|
||||
showLoadingToast() {
|
||||
Toast.loading();
|
||||
Toast.loading({ mask: true });
|
||||
},
|
||||
showSuccessToast() {
|
||||
Toast.success('成功文案');
|
||||
@ -25,7 +25,7 @@ export default {
|
||||
},
|
||||
showCustomizedToast(duration) {
|
||||
const toast = Toast.loading({
|
||||
duration: 0,
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
message: '倒计时 3 秒'
|
||||
});
|
||||
@ -84,7 +84,7 @@ export default {
|
||||
export default {
|
||||
methods: {
|
||||
showLoadingToast() {
|
||||
Toast.loading();
|
||||
Toast.loading({ mask: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,5 +163,6 @@ export default {
|
||||
| type | 提示类型 | `String` | `text` | `loading` `success` `fail` `html` |
|
||||
| message | 内容 | `String` | `''` | - |
|
||||
| position | 位置 | `String` | `middle` | `top` `bottom` |
|
||||
| mask | 是否显示背景蒙层 | `Boolean` | `false` | - |
|
||||
| forbidClick | 禁止背景点击 | `Boolean` | `false` | - |
|
||||
| duration | 时长(ms) | `Number` | `3000` | 值为 0 时,toast 不会消失 |
|
||||
|
@ -8,6 +8,7 @@ const defaultOptions = {
|
||||
type: 'text',
|
||||
position: 'middle',
|
||||
duration: 3000,
|
||||
mask: false,
|
||||
forbidClick: false,
|
||||
clear: () => {
|
||||
instance.visible = false;
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div v-if="message" class="van-toast__text">{{ message }}</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="van-toast__overlay" v-if="forbidClick" />
|
||||
<div :class="['van-toast__overlay', { 'van-toast__overlay--mask': mask }]" v-if="forbidClick || mask" />
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
@ -50,6 +50,10 @@ export default {
|
||||
position: {
|
||||
type: String,
|
||||
default: 'middle'
|
||||
},
|
||||
mask: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -28,7 +28,11 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 3000;
|
||||
background: transparent;
|
||||
background-color: transparent;
|
||||
|
||||
&--mask {
|
||||
background-color: rgba(0, 0, 0, .5);
|
||||
}
|
||||
}
|
||||
|
||||
&--text {
|
||||
|
Loading…
x
Reference in New Issue
Block a user