Yao fbbf539662
[breaking change] Dialog Popup 重构 (#69)
* 重新更改 popup

* 更丰富的popup 功能

* 文档补充

* rebuild dialog

* dialog 文档补充

* 增加 icon 文档
2017-12-03 17:40:42 +08:00

67 lines
1.5 KiB
JavaScript

const Zan = require('../../dist/index');
Page(Object.assign({}, Zan.Dialog, {
toggleBaseDialog() {
this.showZanDialog({
title: '弹窗',
content: '这是一个模态弹窗',
showCancel: true
}).then(() => {
console.log('=== dialog ===', 'type: confirm');
}).catch(() => {
console.log('=== dialog ===', 'type: cancel');
});
},
toggleWithoutTitleDialog() {
this.showZanDialog({
content: '这是一个模态弹窗'
}).then(() => {
console.log('=== dialog without title ===', 'type: confirm');
});
},
toggleButtonDialog() {
this.showZanDialog({
title: '弹窗',
content: '这是一个模态弹窗',
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() {
this.showZanDialog({
title: '弹窗',
content: '这是一个模态弹窗',
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}`);
});
}
}));