Browse Source

fix: menu mode error from vue3.0.3 #3354

pull/3359/head
tangjinzhou 4 years ago
parent
commit
c7816b319e
  1. 8
      components/vc-menu/InjectExtraProps.js

8
components/vc-menu/InjectExtraProps.js

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

Loading…
Cancel
Save