fix: plugin-qiankun修复主应用更新props不触发update

This commit is contained in:
wanchun 2022-05-09 14:07:25 +08:00
parent baff9073c4
commit c0cc29da44

View File

@ -64,13 +64,11 @@ export const MicroApp = defineComponent({
return {};
});
const propsFromParams = attrs;
const propsConfigRef = computed(() => {
return {
...propsFromConfigRef.value,
...props.props,
...propsFromParams
...attrs
};
});
@ -85,7 +83,7 @@ export const MicroApp = defineComponent({
name: `${name}_${Date.now()}`,
entry: entry,
container: containerRef.value,
props: propsConfigRef.value
props: {...propsConfigRef.value}
},
{
...globalSettings,
@ -107,7 +105,7 @@ export const MicroApp = defineComponent({
if (!updatingPromiseRef.value) {
// 初始化 updatingPromiseRef 为 microApp.mountPromise从而确保后续更新是在应用 mount 完成之后
updatingPromiseRef.value = microApp.mountPromise;
} else {
}
// 确保 microApp.update 调用是跟组件状态变更顺序一致的,且后一个微应用更新必须等待前一个更新完成
updatingPromiseRef.value = updatingPromiseRef.value.then(
() => {
@ -133,12 +131,11 @@ export const MicroApp = defineComponent({
}
// 返回 microApp.update 形成链式调用
return microApp.update(propsConfigRef.value);
return microApp.update({...propsConfigRef.value});
}
}
);
}
}
};
onMounted(() => {