mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
[improvement] optimize instance assign (#2284)
This commit is contained in:
parent
b5e10cd95e
commit
d2751ffdfa
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user