fix: menu mode error from vue3.0.3 #3354

This commit is contained in:
tangjinzhou 2020-12-13 08:28:03 +08:00
parent 2bb27a4210
commit c7816b319e

View File

@ -1,4 +1,4 @@
import { createVNode, defineComponent, inject, provide } from 'vue';
import { createVNode, defineComponent, inject, provide, watch } from 'vue';
import { injectExtraPropsKey } from './FunctionProvider';
export default function wrapWithConnect(WrappedComponent) {
@ -13,9 +13,13 @@ export default function wrapWithConnect(WrappedComponent) {
props,
setup(props) {
provide(injectExtraPropsKey, undefined); // 断掉 injectExtraPropsKey 的依赖
const injectExtraProps = injectExtraPropsKey ? inject(injectExtraPropsKey, () => ({})) : {};
watch(injectExtraProps, ()=>{
// 神奇的问题vue 3.0.3 之后,没能正确响应式,暂时加个 watch hack 一下
});
return {
props,
injectExtraProps: injectExtraPropsKey ? inject(injectExtraPropsKey, () => ({})) : {},
injectExtraProps,
};
},
methods: {