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));
|
|
|
|
}
|
2020-10-24 12:36:57 +00:00
|
|
|
return () => slots.default?.();
|
2020-10-20 15:13:49 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export default FunctionProvider;
|