[bugfix] Dialog: default options (#999)

This commit is contained in:
neverland 2018-12-03 16:36:01 +08:00 committed by GitHub
parent 10c54fc649
commit c25654d153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,6 +38,11 @@ function getContext() {
} }
const Dialog: Dialog = options => { const Dialog: Dialog = options => {
options = {
...Dialog.currentOptions,
...options
};
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const context = options.context || getContext(); const context = options.context || getContext();
const dialog = context.selectComponent(options.selector); const dialog = context.selectComponent(options.selector);
@ -73,15 +78,10 @@ Dialog.defaultOptions = {
transition: true transition: true
}; };
Dialog.alert = options => Dialog.alert = Dialog;
Dialog({
...Dialog.currentOptions,
...options
});
Dialog.confirm = options => Dialog.confirm = options =>
Dialog({ Dialog({
...Dialog.currentOptions,
showCancelButton: true, showCancelButton: true,
...options ...options
}); });