HoverContext.js 347 B

123456789101112
  1. import { shallowRef, inject, provide } from 'vue';
  2. export const HoverContextKey = Symbol('HoverContextProps');
  3. export const useProvideHover = props => {
  4. provide(HoverContextKey, props);
  5. };
  6. export const useInjectHover = () => {
  7. return inject(HoverContextKey, {
  8. startRow: shallowRef(-1),
  9. endRow: shallowRef(-1),
  10. onHover() {}
  11. });
  12. };