mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[new feature] Dialog: add close-on-popstate prop (#3709)
This commit is contained in:
parent
2df51f5aef
commit
e4ce6137bf
@ -1,11 +1,12 @@
|
||||
import { createNamespace } from '../utils';
|
||||
import { PopupMixin } from '../mixins/popup';
|
||||
import { CloseOnPopstateMixin } from '../mixins/close-on-popstate';
|
||||
import Button from '../button';
|
||||
|
||||
const [createComponent, bem, t] = createNamespace('dialog');
|
||||
|
||||
export default createComponent({
|
||||
mixins: [PopupMixin],
|
||||
mixins: [PopupMixin, CloseOnPopstateMixin],
|
||||
|
||||
props: {
|
||||
title: String,
|
||||
|
@ -128,6 +128,7 @@ export default {
|
||||
| confirmButtonText | Confirm button text | `String` | `Confirm` |
|
||||
| confirmButtonColor | Confirm button color | `String` | `#1989fa` |
|
||||
| overlay | Whether to show overlay | `Boolean` | `true` |
|
||||
| closeOnPopstate | Whether to close when popstate | `Boolean` | `false` |
|
||||
| closeOnClickOverlay | Whether to close when click overlay | `Boolean` | `false` |
|
||||
| lockScroll | Whether to lock body scroll | `Boolean` | `true` |
|
||||
| beforeClose | Callback before close,<br>call done() to close dialog,<br>call done(false) to cancel loading | (action: string, done: function) => void | - |
|
||||
|
@ -157,6 +157,7 @@ export default {
|
||||
| confirmButtonText | 确认按钮文案 | `String` | `确认` | - |
|
||||
| confirmButtonColor | 确认按钮颜色 | `String` | `#1989fa` | 1.6.14 |
|
||||
| overlay | 是否展示遮罩层 | `Boolean` | `true` | - |
|
||||
| closeOnPopstate | 是否在页面回退时自动关闭 | `Boolean` | `false` | 2.0.5 |
|
||||
| closeOnClickOverlay | 点击遮罩层时是否关闭弹窗 | `Boolean` | `false` | - |
|
||||
| lockScroll | 是否锁定背景滚动 | `Boolean` | `true` | - |
|
||||
| beforeClose | 关闭前的回调函数,<br>调用 done() 后关闭弹窗,<br>调用 done(false) 阻止弹窗关闭 | `(action, done) => void` | - | - |
|
||||
|
@ -60,6 +60,7 @@ Dialog.defaultOptions = {
|
||||
confirmButtonColor: null,
|
||||
showConfirmButton: true,
|
||||
showCancelButton: false,
|
||||
closeOnPopstate: false,
|
||||
closeOnClickOverlay: false,
|
||||
callback: action => {
|
||||
instance[action === 'confirm' ? 'resolve' : 'reject'](action);
|
||||
|
Loading…
x
Reference in New Issue
Block a user