docs(dialog): update description (#6442)

This commit is contained in:
neverland 2020-06-02 22:31:52 +08:00 committed by GitHub
parent 4d731a3fa8
commit e7082ca57a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 12 deletions

View File

@ -13,7 +13,7 @@ Vue.use(Dialog);
### Alert dialog ### Alert dialog
Used to prompt for some messages, only including one confirm button Used to prompt for some messages, only including one confirm button.
```js ```js
Dialog.alert({ Dialog.alert({
@ -32,7 +32,7 @@ Dialog.alert({
### Confirm dialog ### Confirm dialog
Used to confirm some messages, including a confirm button and a cancel button Used to confirm some messages, including a confirm button and a cancel button.
```js ```js
Dialog.confirm({ Dialog.confirm({
@ -65,9 +65,9 @@ Dialog.confirm({
}); });
``` ```
### \$dialog Method ### Global Method
After import the Dialog component, the \$dialog method is automatically mounted on Vue.prototype, making it easy to call within a vue component. After import the Dialog component, the `$dialog` method is automatically mounted on Vue.prototype, making it easy to call within a vue component.
```js ```js
export default { export default {

View File

@ -2,13 +2,13 @@
### 介绍 ### 介绍
弹出模态框,常用于消息提示、消息确认、在当前页面内完成特定的交互操作 弹出模态框,常用于消息提示、消息确认,或在当前页面内完成特定的交互操作。
弹出框组件支持函数调用和组件调用两种方式 弹出框组件支持函数调用和组件调用两种方式
### 函数调用 ### 函数调用
Dialog 是一个函数,调用后展示提示弹窗 Dialog 是一个函数,调用后会直接在页面中弹出相应的模态框。
```js ```js
import { Dialog } from 'vant'; import { Dialog } from 'vant';
@ -18,7 +18,7 @@ Dialog({ message: '提示' });
### 组件调用 ### 组件调用
通过组件调用 Dialog 时,可以通过下面的方式进行注册 通过组件调用 Dialog 时,可以通过下面的方式进行注册
```js ```js
import Vue from 'vue'; import Vue from 'vue';
@ -39,7 +39,7 @@ export default {
### 消息提示 ### 消息提示
用于提示一些消息,只包含一个确认按钮 用于提示一些消息,只包含一个确认按钮
```js ```js
Dialog.alert({ Dialog.alert({
@ -58,7 +58,7 @@ Dialog.alert({
### 消息确认 ### 消息确认
用于确认消息,包含取消和确认按钮 用于确认消息,包含取消和确认按钮
```js ```js
Dialog.confirm({ Dialog.confirm({
@ -75,6 +75,8 @@ Dialog.confirm({
### 异步关闭 ### 异步关闭
通过 `beforeClose` 属性可以传入一个回调函数,在弹窗关闭前进行特定操作。
```js ```js
function beforeClose(action, done) { function beforeClose(action, done) {
if (action === 'confirm') { if (action === 'confirm') {
@ -93,7 +95,7 @@ Dialog.confirm({
### 全局方法 ### 全局方法
引入 Dialog 组件后,会自动在 Vue 的 prototype 上挂载 \$dialog 方法,在所有组件内部都可以直接调用此方法 引入 Dialog 组件后,会自动在 Vue 的 prototype 上挂载 `$dialog` 方法,在所有组件内部都可以直接调用此方法
```js ```js
export default { export default {
@ -107,7 +109,7 @@ export default {
### 组件调用 ### 组件调用
如果需要在弹窗内嵌入组件或其他自定义内容,可以使用组件调用的方式 如果需要在弹窗内嵌入组件或其他自定义内容,可以使用组件调用的方式
```html ```html
<van-dialog v-model="show" title="标题" show-cancel-button> <van-dialog v-model="show" title="标题" show-cancel-button>