mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
71 lines
1.6 KiB
JavaScript
71 lines
1.6 KiB
JavaScript
const Dialog = require('../../dist/dialog/dialog');
|
|
|
|
Page({
|
|
toggleBaseDialog() {
|
|
Dialog({
|
|
title: '弹窗',
|
|
message: '这是一个模态弹窗\n换行',
|
|
selector: '#zan-base-dialog',
|
|
showCancelButton: true
|
|
}).then(() => {
|
|
console.log('=== dialog resolve ===', 'type: confirm');
|
|
}).catch(() => {
|
|
console.log('=== dialog reject ===', 'type: cancel');
|
|
});
|
|
},
|
|
|
|
toggleWithoutTitleDialog() {
|
|
Dialog({
|
|
message: '这是一个模态弹窗',
|
|
selector: '#zan-no-title-dialog'
|
|
}).then(() => {
|
|
console.log('=== dialog ===', 'type: confirm');
|
|
});
|
|
},
|
|
|
|
toggleButtonDialog() {
|
|
Dialog({
|
|
title: '弹窗',
|
|
message: '这是一个模态弹窗',
|
|
selector: '#zan-button-dialog',
|
|
buttons: [{
|
|
text: '现金支付',
|
|
color: 'red',
|
|
type: 'cash'
|
|
}, {
|
|
text: '微信支付',
|
|
color: '#3CC51F',
|
|
type: 'wechat'
|
|
}, {
|
|
text: '取消',
|
|
type: 'cancel'
|
|
}]
|
|
}).then(({ type }) => {
|
|
console.log('=== dialog with custom buttons ===', `type: ${type}`);
|
|
});
|
|
},
|
|
|
|
toggleVerticalDialog() {
|
|
Dialog({
|
|
title: '弹窗',
|
|
message: '这是一个模态弹窗',
|
|
selector: '#zan-vertical-dialog',
|
|
buttonsShowVertical: true,
|
|
buttons: [{
|
|
text: '现金支付',
|
|
color: 'red',
|
|
type: 'cash'
|
|
}, {
|
|
text: '微信支付',
|
|
color: '#3CC51F',
|
|
type: 'wechat'
|
|
}, {
|
|
text: '取消',
|
|
type: 'cancel'
|
|
}]
|
|
}).then(({ type }) => {
|
|
console.log('=== dialog with vertical buttons ===', `type: ${type}`);
|
|
});
|
|
}
|
|
});
|