context.js 516 B

1234567891011121314151617
  1. import { computed, inject, provide } from 'vue';
  2. const SlotsContextKey = Symbol('SlotsContextProps');
  3. export const useProvideSlots = props => {
  4. provide(SlotsContextKey, props);
  5. };
  6. export const useInjectSlots = () => {
  7. return inject(SlotsContextKey, computed(() => ({})));
  8. };
  9. const ContextKey = Symbol('ContextProps');
  10. export const useProvideTableContext = props => {
  11. provide(ContextKey, props);
  12. };
  13. export const useInjectTableContext = () => {
  14. return inject(ContextKey, {
  15. onResizeColumn: () => {}
  16. });
  17. };