import { Hot } from '@/types/components';
import { ref, Ref } from 'vue';

// handsontable 组件的模板引用相关代码
export default function useHotRef() {
  // 用于定义模板引用
  const handsontableRef = () => {
    return ref<Hot.IHandsontableComponent | null>(null);
  };
  // 断言非 null
  const notNull = (hotRef: Ref<Hot.IHandsontableComponent | null>) => {
    return hotRef.value as Hot.IHandsontableComponent;
  };
  return {
    getHotRef: handsontableRef,
    notNull,
  };
}
