提交 c889fb17 作者: vben

fix(use-table): fix types

上级 55d4b77b
......@@ -78,7 +78,7 @@
"eslint": "^7.18.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.4.1",
"eslint-plugin-vue": "^7.5.0",
"esno": "^0.4.0",
"fs-extra": "^9.1.0",
"husky": "^4.3.8",
......@@ -100,13 +100,13 @@
"stylelint-order": "^4.1.0",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"vite": "2.0.0-beta.35",
"vite": "2.0.0-beta.36",
"vite-plugin-html": "^2.0.0-beta.5",
"vite-plugin-mock": "^2.0.0-beta.3",
"vite-plugin-purge-icons": "^0.5.2",
"vite-plugin-pwa": "^0.3.9",
"vite-plugin-style-import": "^0.4.6",
"vue-eslint-parser": "^7.3.0",
"vue-eslint-parser": "^7.4.1",
"yargs": "^16.2.0"
},
"repository": {
......
......@@ -11,16 +11,20 @@ import type { FormActionType } from '/@/components/Form';
type Props = Partial<DynamicProps<BasicTableProps>>;
type UseTableMethod = TableActionType & {
getForm: () => FormActionType;
};
export function useTable(
tableProps?: Props
): [(instance: TableActionType, formInstance: FormActionType) => void, TableActionType] {
): [(instance: TableActionType, formInstance: UseTableMethod) => void, TableActionType] {
isInSetup();
const tableRef = ref<Nullable<TableActionType>>(null);
const loadedRef = ref<Nullable<boolean>>(false);
const formRef = ref<Nullable<FormActionType>>(null);
const formRef = ref<Nullable<UseTableMethod>>(null);
function register(instance: TableActionType, formInstance: FormActionType) {
function register(instance: TableActionType, formInstance: UseTableMethod) {
isProdMode() &&
onUnmounted(() => {
tableRef.value = null;
......@@ -119,7 +123,7 @@ export function useTable(
return getTableInstance().getCacheColumns();
},
getForm: () => {
return unref(formRef) as FormActionType;
return (unref(formRef) as unknown) as FormActionType;
},
setShowPagination: async (show: boolean) => {
getTableInstance().setShowPagination(show);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论