mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
docs(Dialog): add beforeRouteLeave faq (#9853)
This commit is contained in:
parent
791e20e7a9
commit
33ff262d8f
@ -68,7 +68,7 @@ Dialog.alert({
|
||||
});
|
||||
```
|
||||
|
||||
### Asnyc Close
|
||||
### Async Close
|
||||
|
||||
```js
|
||||
function beforeClose(action, done) {
|
||||
@ -128,7 +128,7 @@ export default {
|
||||
| --- | --- | --- | --- |
|
||||
| Dialog | Show dialog | `options` | `Promise` |
|
||||
| Dialog.alert | Show alert dialog | `options` | `Promise` |
|
||||
| Dialog.confirm | Show confim dialog | `options` | `Promise` |
|
||||
| Dialog.confirm | Show confirm dialog | `options` | `Promise` |
|
||||
| Dialog.setDefaultOptions | Set default options of all dialogs | `options` | `void` |
|
||||
| Dialog.resetDefaultOptions | Reset default options of all dialogs | - | `void` |
|
||||
| Dialog.close | Close dialog | - | `void` |
|
||||
@ -157,7 +157,7 @@ export default {
|
||||
| lockScroll | Whether to lock body scroll | _boolean_ | `true` |
|
||||
| allowHtml `v2.8.7` | Whether to allow HTML rendering in message | _boolean_ | `true` |
|
||||
| beforeClose | Callback before close,<br>call done() to close dialog,<br>call done(false) to cancel loading | (action: string, done: Function) => void | - |
|
||||
| transition | Transition, equivalent to `name` prop of [transtion](https://vuejs.org/v2/api/#transition) | _string_ | - |
|
||||
| transition | Transition, equivalent to `name` prop of [transition](https://vuejs.org/v2/api/#transition) | _string_ | - |
|
||||
| getContainer | Return the mount node for Dialog | _string \| () => Element_ | `body` |
|
||||
|
||||
### Props
|
||||
@ -185,7 +185,7 @@ export default {
|
||||
| lock-scroll | Whether to lock background scroll | _boolean_ | `true` |
|
||||
| allow-html `v2.8.7` | Whether to allow HTML rendering in message | _boolean_ | `true` |
|
||||
| before-close | Callback before close,<br>call done() to close dialog,<br>call done(false) to cancel loading | (action: string, done: Function) => void | - |
|
||||
| transition | Transition, equivalent to `name` prop of [transtion](https://vuejs.org/v2/api/#transition) | _string_ | - |
|
||||
| transition | Transition, equivalent to `name` prop of [transition](https://vuejs.org/v2/api/#transition) | _string_ | - |
|
||||
| get-container | Return the mount node for Dialog | _string \| () => Element_ | - |
|
||||
|
||||
### Events
|
||||
|
@ -187,7 +187,7 @@ export default {
|
||||
| lockScroll | 是否锁定背景滚动 | _boolean_ | `true` |
|
||||
| allowHtml `v2.8.7` | 是否允许 message 内容中渲染 HTML | _boolean_ | `true` |
|
||||
| beforeClose | 关闭前的回调函数,<br>调用 done() 后关闭弹窗,<br>调用 done(false) 阻止弹窗关闭 | _(action, done) => void_ | - |
|
||||
| transition | 动画类名,等价于 [transtion](https://cn.vuejs.org/v2/api/index.html#transition) 的`name`属性 | _string_ | - |
|
||||
| transition | 动画类名,等价于 [transition](https://cn.vuejs.org/v2/api/index.html#transition) 的`name`属性 | _string_ | - |
|
||||
| getContainer | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| () => Element_ | `body` |
|
||||
|
||||
### Props
|
||||
@ -217,7 +217,7 @@ export default {
|
||||
| lock-scroll | 是否锁定背景滚动 | _boolean_ | `true` |
|
||||
| allow-html `v2.8.7` | 是否允许 message 内容中渲染 HTML | _boolean_ | `true` |
|
||||
| before-close | 关闭前的回调函数,<br>调用 done() 后关闭弹窗,<br>调用 done(false) 阻止弹窗关闭 | _(action, done) => void_ | - |
|
||||
| transition | 动画类名,等价于 [transtion](https://cn.vuejs.org/v2/api/index.html#transition) 的 `name` 属性 | _string_ | - |
|
||||
| transition | 动画类名,等价于 [transition](https://cn.vuejs.org/v2/api/index.html#transition) 的 `name` 属性 | _string_ | - |
|
||||
| get-container | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| () => Element_ | - |
|
||||
|
||||
### Events
|
||||
@ -267,3 +267,19 @@ export default {
|
||||
| @dialog-button-height | `48px` | - |
|
||||
| @dialog-round-button-height | `36px` | - |
|
||||
| @dialog-confirm-button-text-color | `@red` | - |
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 在 beforeRouteLeave 里调用 Dialog 无法展示?
|
||||
|
||||
将 `closeOnPopstate` 属性设置为 false 即可。
|
||||
|
||||
```js
|
||||
Dialog.alert({
|
||||
title: '标题',
|
||||
message: '弹窗内容',
|
||||
closeOnPopstate: false,
|
||||
}).then(() => {
|
||||
// on close
|
||||
});
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user