ant-design-vue/components/vc-menu/FunctionProvider.jsx

18 lines
425 B
Vue
Raw Normal View History

2020-10-20 15:13:49 +00:00
import PropTypes from '../_util/vue-types';
import { provide, reactive } from 'vue';
const FunctionProvider = {
inheritAttrs: false,
props: {
injectExtraPropsKey: PropTypes.string,
},
setup(props, { slots, attrs }) {
if (props.injectExtraPropsKey) {
provide(props.injectExtraPropsKey, reactive(attrs));
}
return () => slots.default && slots.default();
},
};
export default FunctionProvider;