mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
* fix: Tabbar icon line-height * [new feature] progress add showPivot prop * [new feature] TabItem support vue-router * [new feature] update document header style * [Doc] add toast english ducoment * [new feature] add i18n support * feat: Extract demos from markdown * feat: Base components demos * [new feature] complete demo extract & translate * [fix] text cases * fix: add deepAssign test cases * fix: changelog detail * [new feature] AddressEdit support i18n
1.6 KiB
1.6 KiB
Dialog
Install
import { Dialog } from 'vant';
Usage
Alert dialog
Used to prompt for some messages, only including one confirm button
Dialog.alert({
title: 'Title',
message: 'Content'
}).then(() => {
// on close
});
Dialog.alert({
message: 'Content'
}).then(() => {
// on close
});
Confirm dialog
Used to confirm some messages, including a confirm button and a cancel button
Dialog.confirm({
title: 'Title',
message: 'Content'
}).then(() => {
// on confirm
}).catch(() => {
// on cancel
});
Methods
Name | Attribute | Return value | Description |
---|---|---|---|
Dialog.alert | options | Promise |
Show alert dialog |
Dialog.confirm | options | Promise |
Show confim dialog |
Dialog.close | - | void |
Close dialog |
Options
Attribute | Description | Type | Default | Accepted Values |
---|---|---|---|---|
title | Title | String |
- | - |
message | Message | String |
- | - |
showConfirmButton | Whether to show confirm button | Boolean |
true |
- |
showCancelButton | Whether to show cancel button | Boolean |
false |
- |
confirmButtonText | Confirm button text | String |
Confirm |
- |
cancelButtonText | Cancel button test | String |
Cancel |
- |
overlay | Whether to show overlay | Boolean |
true |
- |
closeOnClickOverlay | Whether to close when click overlay | Boolean |
false |
- |
lockOnScroll | Whether to lock body scroll | Boolean |
true |
- |