Skip to content

Commit 4aeee48

Browse files
committed
增加 useCrudSchemas、useTable 的 autoimport 实现
1 parent 3f2a77f commit 4aeee48

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

build/vite/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ export function createVitePlugins(VITE_APP_TITLE: string) {
3939
imports: [
4040
'vue',
4141
'vue-router',
42+
// 可额外添加需要 autoImport 的组件
4243
{
4344
'@/hooks/web/useI18n': ['useI18n'],
44-
'@/hooks/web/useXTable': ['useXTable'],
4545
'@/hooks/web/useMessage': ['useMessage'],
46+
'@/hooks/web/useXTable': ['useXTable'],
4647
'@/hooks/web/useVxeCrudSchemas': ['useVxeCrudSchemas'],
48+
'@/hooks/web/useTable': ['useTable'],
49+
'@/hooks/web/useCrudSchemas': ['useCrudSchemas'],
4750
'@/utils/formRules': ['required'],
4851
'@/utils/dict': ['DICT_TYPE']
4952
}

src/types/auto-imports.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ declare global {
5252
const triggerRef: typeof import('vue')['triggerRef']
5353
const unref: typeof import('vue')['unref']
5454
const useAttrs: typeof import('vue')['useAttrs']
55+
const useCrudSchemas: typeof import('@/hooks/web/useCrudSchemas')['useCrudSchemas']
5556
const useCssModule: typeof import('vue')['useCssModule']
5657
const useCssVars: typeof import('vue')['useCssVars']
5758
const useI18n: typeof import('@/hooks/web/useI18n')['useI18n']
@@ -60,6 +61,7 @@ declare global {
6061
const useRoute: typeof import('vue-router')['useRoute']
6162
const useRouter: typeof import('vue-router')['useRouter']
6263
const useSlots: typeof import('vue')['useSlots']
64+
const useTable: typeof import('@/hooks/web/useTable')['useTable']
6365
const useVxeCrudSchemas: typeof import('@/hooks/web/useVxeCrudSchemas')['useVxeCrudSchemas']
6466
const useXTable: typeof import('@/hooks/web/useXTable')['useXTable']
6567
const watch: typeof import('vue')['watch']

src/views/system/mail/account/account.data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
1+
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
22
import { DictTag } from '@/components/DictTag'
33
import { TableColumn } from '@/types/table'
44
import { dateFormatter } from '@/utils/formatTime'

src/views/system/mail/account/index.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@
5353
</template>
5454
<script setup lang="ts" name="MailAccount">
5555
import { allSchemas } from './account.data'
56-
import { useTable } from '@/hooks/web/useTable'
5756
import * as MailAccountApi from '@/api/system/mail/account'
5857
import MailAccountForm from './form.vue'
5958
60-
// https://kailong110120130.gitee.io/vue-element-plus-admin-doc/components/table.html#usetable
6159
// tableObject:表格的属性对象,可获得分页大小、条数等属性
6260
// tableMethods:表格的操作对象,可进行获得分页、删除记录等操作
61+
// 详细可见:https://kailong110120130.gitee.io/vue-element-plus-admin-doc/components/table.html#usetable
6362
const { tableObject, tableMethods } = useTable({
6463
getListApi: MailAccountApi.getMailAccountPage, // 分页接口
6564
delListApi: MailAccountApi.deleteMailAccount // 删除接口

0 commit comments

Comments
 (0)