增加 useCrudSchemas、useTable 的 autoimport 实现

This commit is contained in:
YunaiV 2023-03-17 22:58:49 +08:00
parent 3f2a77f2d2
commit 4aeee48582
4 changed files with 8 additions and 4 deletions

View File

@ -39,11 +39,14 @@ export function createVitePlugins(VITE_APP_TITLE: string) {
imports: [ imports: [
'vue', 'vue',
'vue-router', 'vue-router',
// 可额外添加需要 autoImport 的组件
{ {
'@/hooks/web/useI18n': ['useI18n'], '@/hooks/web/useI18n': ['useI18n'],
'@/hooks/web/useXTable': ['useXTable'],
'@/hooks/web/useMessage': ['useMessage'], '@/hooks/web/useMessage': ['useMessage'],
'@/hooks/web/useXTable': ['useXTable'],
'@/hooks/web/useVxeCrudSchemas': ['useVxeCrudSchemas'], '@/hooks/web/useVxeCrudSchemas': ['useVxeCrudSchemas'],
'@/hooks/web/useTable': ['useTable'],
'@/hooks/web/useCrudSchemas': ['useCrudSchemas'],
'@/utils/formRules': ['required'], '@/utils/formRules': ['required'],
'@/utils/dict': ['DICT_TYPE'] '@/utils/dict': ['DICT_TYPE']
} }

View File

@ -52,6 +52,7 @@ declare global {
const triggerRef: typeof import('vue')['triggerRef'] const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref'] const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs'] const useAttrs: typeof import('vue')['useAttrs']
const useCrudSchemas: typeof import('@/hooks/web/useCrudSchemas')['useCrudSchemas']
const useCssModule: typeof import('vue')['useCssModule'] const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars'] const useCssVars: typeof import('vue')['useCssVars']
const useI18n: typeof import('@/hooks/web/useI18n')['useI18n'] const useI18n: typeof import('@/hooks/web/useI18n')['useI18n']
@ -60,6 +61,7 @@ declare global {
const useRoute: typeof import('vue-router')['useRoute'] const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter'] const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots'] const useSlots: typeof import('vue')['useSlots']
const useTable: typeof import('@/hooks/web/useTable')['useTable']
const useVxeCrudSchemas: typeof import('@/hooks/web/useVxeCrudSchemas')['useVxeCrudSchemas'] const useVxeCrudSchemas: typeof import('@/hooks/web/useVxeCrudSchemas')['useVxeCrudSchemas']
const useXTable: typeof import('@/hooks/web/useXTable')['useXTable'] const useXTable: typeof import('@/hooks/web/useXTable')['useXTable']
const watch: typeof import('vue')['watch'] const watch: typeof import('vue')['watch']

View File

@ -1,4 +1,4 @@
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { DictTag } from '@/components/DictTag' import { DictTag } from '@/components/DictTag'
import { TableColumn } from '@/types/table' import { TableColumn } from '@/types/table'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'

View File

@ -53,13 +53,12 @@
</template> </template>
<script setup lang="ts" name="MailAccount"> <script setup lang="ts" name="MailAccount">
import { allSchemas } from './account.data' import { allSchemas } from './account.data'
import { useTable } from '@/hooks/web/useTable'
import * as MailAccountApi from '@/api/system/mail/account' import * as MailAccountApi from '@/api/system/mail/account'
import MailAccountForm from './form.vue' import MailAccountForm from './form.vue'
// https://kailong110120130.gitee.io/vue-element-plus-admin-doc/components/table.html#usetable
// tableObject // tableObject
// tableMethods // tableMethods
// https://kailong110120130.gitee.io/vue-element-plus-admin-doc/components/table.html#usetable
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: MailAccountApi.getMailAccountPage, // getListApi: MailAccountApi.getMailAccountPage, //
delListApi: MailAccountApi.deleteMailAccount // delListApi: MailAccountApi.deleteMailAccount //