[improvement] optimize instance assign (#2284)

This commit is contained in:
neverland 2018-12-13 16:05:11 +08:00 committed by GitHub
parent b5e10cd95e
commit d2751ffdfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 16 deletions

View File

@ -27,11 +27,9 @@ const Dialog = options => {
initInstance();
}
Object.assign(instance, {
Object.assign(instance, Dialog.currentOptions, options, {
resolve,
reject,
...Dialog.currentOptions,
...options
reject
});
});
};
@ -57,10 +55,11 @@ Dialog.defaultOptions = {
Dialog.alert = Dialog;
Dialog.confirm = options => Dialog({
showCancelButton: true,
...options
});
Dialog.confirm = options =>
Dialog({
showCancelButton: true,
...options
});
Dialog.close = () => {
if (instance) {

View File

@ -33,10 +33,7 @@ const ImagePreview = (images, startPosition = 0) => {
const options = Array.isArray(images) ? { images, startPosition } : images;
Object.assign(instance, {
...defaultConfig,
...options
});
Object.assign(instance, defaultConfig, options);
instance.$once('input', show => {
instance.value = show;

View File

@ -15,7 +15,7 @@ export default {
const target = el && el.parentNode ? el.parentNode : document.body;
context.stack.push({ vm, config, target });
this.update();
};
}
},
close(vm) {
@ -51,9 +51,7 @@ export default {
const { target, config } = context.top;
target.appendChild(modal.$el);
Object.assign(modal, {
...defaultConfig,
...config,
Object.assign(modal, defaultConfig, config, {
visible: true
});
}