mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
parent
2e28702b8c
commit
84f73456fc
@ -124,8 +124,8 @@ Page({
|
||||
|
||||
通过函数调用 Dialog 时,支持传入以下选项:
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----------|-----------|-----------|-------------|
|
||||
| 参数 | 说明 | 类型 | 默认值 | 生效时机 |
|
||||
|-----------|-----------|-----------|-------------|-------------|
|
||||
| title | 标题 | `String` | - |
|
||||
| message | 内容 | `String` | - |
|
||||
| messageAlign | 内容对齐方式,可选值为`left` `right` | `String` | `center` |
|
||||
@ -141,13 +141,21 @@ Page({
|
||||
| asyncClose | 是否异步关闭弹窗,开启后需要手动控制弹窗的关闭 | `Boolean` | `false` |
|
||||
| context | 选择器的选择范围,可以传入自定义组件的 this 作为上下文 | `Object` | 当前页面 |
|
||||
| transition | 动画名称,可选值为`fade` | `String` | `scale` |
|
||||
| app-parameter | 打开 APP 时,向 APP 传递的参数 | `String` | - | `confirmButtonOpenType="launchApp"` |
|
||||
| lang | 指定返回用户信息的语言,zh_CN 简体中文,<br>zh_TW 繁体中文,en 英文 | `String` | `en` | `confirmButtonOpenType="getUserInfo"` |
|
||||
| session-from | 会话来源 | `String` | - | `confirmButtonOpenType="contact"` |
|
||||
| business-id | 客服消息子商户 id | `Number` | - |
|
||||
| send-message-title | 会话内消息卡片标题 | `String` | 当前标题 | `confirmButtonOpenType="contact"` |
|
||||
| send-message-path | 会话内消息卡片点击跳转小程序路径 | `String` | 当前分享路径 | `confirmButtonOpenType="contact"` |
|
||||
| send-message-img | sendMessageImg | `String` | 截图 | `confirmButtonOpenType="contact"` |
|
||||
| show-message-card | 显示会话内消息卡片 | `String` | `false` | `confirmButtonOpenType="contact"` |
|
||||
|
||||
### API
|
||||
|
||||
通过组件调用 Dialog 时,支持以下 API:
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----------|-----------|-----------|-------------|
|
||||
| 参数 | 说明 | 类型 | 默认值 | 生效时机 |
|
||||
|-----------|-----------|-----------|-------------|-------------|
|
||||
| show | 是否显示弹窗 | `Boolean` | - |
|
||||
| title | 标题 | `String` | - |
|
||||
| message | 内容 | `String` | - |
|
||||
@ -163,6 +171,14 @@ Page({
|
||||
| use-slot | 是否使用自定义内容的插槽 | `Boolean` | `false` |
|
||||
| async-close | 是否异步关闭弹窗,开启后需要手动控制弹窗的关闭 | `Boolean` | `false` |
|
||||
| transition | 动画名称,可选值为`fade` | `String` | `scale` |
|
||||
| app-parameter | 打开 APP 时,向 APP 传递的参数 | `String` | - | `confirm-button-open-type="launchApp"` |
|
||||
| lang | 指定返回用户信息的语言,zh_CN 简体中文,<br>zh_TW 繁体中文,en 英文 | `String` | `en` | `confirm-button-open-type="getUserInfo"` |
|
||||
| session-from | 会话来源 | `String` | - | `confirm-button-open-type="contact"` |
|
||||
| business-id | 客服消息子商户 id | `Number` | - |
|
||||
| send-message-title | 会话内消息卡片标题 | `String` | 当前标题 | `confirm-button-open-type="contact"` |
|
||||
| send-message-path | 会话内消息卡片点击跳转小程序路径 | `String` | 当前分享路径 | `confirm-button-open-type="contact"` |
|
||||
| send-message-img | sendMessageImg | `String` | 截图 | `confirm-button-open-type="contact"` |
|
||||
| show-message-card | 显示会话内消息卡片 | `String` | `false` | `confirm-button-open-type="contact"` |
|
||||
|
||||
### Event
|
||||
|
||||
|
@ -2,6 +2,7 @@ let queue = [];
|
||||
|
||||
type DialogAction = 'confirm' | 'cancel';
|
||||
type DialogOptions = {
|
||||
lang?: string;
|
||||
show?: boolean;
|
||||
title?: string;
|
||||
zIndex?: number;
|
||||
@ -9,9 +10,17 @@ type DialogOptions = {
|
||||
message?: string;
|
||||
overlay?: boolean;
|
||||
selector?: string;
|
||||
ariaLabel?: string;
|
||||
transition?: string;
|
||||
asyncClose?: boolean;
|
||||
businessId?: number;
|
||||
sessionFrom?: string;
|
||||
appParameter?: string;
|
||||
messageAlign?: string;
|
||||
sendMessageImg?: string;
|
||||
showMessageCard?: boolean;
|
||||
sendMessagePath?: string;
|
||||
sendMessageTitle?: string;
|
||||
confirmButtonText?: string;
|
||||
cancelButtonText?: string;
|
||||
showConfirmButton?: boolean;
|
||||
|
@ -1,8 +1,11 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { button } from '../mixins/button';
|
||||
import { openType } from '../mixins/open-type';
|
||||
|
||||
type Action = 'confirm' | 'cancel' | 'overlay';
|
||||
|
||||
VantComponent({
|
||||
mixins: [openType],
|
||||
mixins: [button, openType],
|
||||
|
||||
props: {
|
||||
show: Boolean,
|
||||
@ -48,7 +51,7 @@ VantComponent({
|
||||
},
|
||||
|
||||
watch: {
|
||||
show(show) {
|
||||
show(show: boolean) {
|
||||
!show && this.stopLoading();
|
||||
}
|
||||
},
|
||||
@ -66,7 +69,7 @@ VantComponent({
|
||||
this.onClose('overlay');
|
||||
},
|
||||
|
||||
handleAction(action) {
|
||||
handleAction(action: Action) {
|
||||
if (this.data.asyncClose) {
|
||||
this.set({
|
||||
[`loading.${action}`]: true
|
||||
@ -91,7 +94,7 @@ VantComponent({
|
||||
});
|
||||
},
|
||||
|
||||
onClose(action) {
|
||||
onClose(action: Action) {
|
||||
if (!this.data.asyncClose) {
|
||||
this.close();
|
||||
}
|
||||
|
@ -39,13 +39,24 @@
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm"
|
||||
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
lang="{{ lang }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
|
||||
bind:click="onConfirm"
|
||||
binderror="bindError"
|
||||
bindcontact="bindContact"
|
||||
bindopensetting="bindOpenSetting"
|
||||
bindgetuserinfo="bindGetUserInfo"
|
||||
bindcontact="bindContact"
|
||||
bindgetphonenumber="bindGetPhoneNumber"
|
||||
binderror="bindError"
|
||||
bindlaunchapp="bindLaunchApp"
|
||||
bindopensetting="bindOpenSetting"
|
||||
>
|
||||
{{ confirmButtonText }}
|
||||
</van-button>
|
||||
|
@ -12,7 +12,7 @@ export const button = Behavior({
|
||||
sendMessageTitle: String,
|
||||
sendMessagePath: String,
|
||||
sendMessageImg: String,
|
||||
showMessageCard: String,
|
||||
showMessageCard: Boolean,
|
||||
appParameter: String,
|
||||
ariaLabel: String
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user