diff --git a/commitlint.config.js b/commitlint.config.js index 405e185..20116c9 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,2 +1,11 @@ // commit-lint config -module.exports = { extends: ['@commitlint/config-conventional'] }; +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test', 'types'], + ], + }, +}; diff --git a/package.json b/package.json index 9952028..04786a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "tdesign-vue-next-starter", - "version": "0.7.5", + "name": "@tencent/tdesign-vue-next-starter", + "version": "0.7.6", "scripts": { "dev:mock": "vite --open --mode mock", "dev": "vite --open --mode development", @@ -28,9 +28,9 @@ "pinia-plugin-persistedstate": "^3.1.0", "qrcode.vue": "^3.3.4", "qs": "^6.11.1", - "tdesign-icons-vue-next": "^0.1.8", - "tdesign-vue-next": "^1.2.2", - "tvision-color": "^1.5.0", + "tdesign-icons-vue-next": "^0.1.11", + "tdesign-vue-next": "^1.3.4", + "tvision-color": "^1.6.0", "vue": "^3.2.47", "vue-clipboard3": "^2.0.0", "vue-router": "~4.1.6" @@ -83,12 +83,10 @@ "lint-staged": { "*.{js,jsx,vue,ts,tsx}": [ "prettier --write", - "npm run lint:fix", - "git add ." + "npm run lint:fix" ], "*.{html,vue,vss,sass,less}": [ - "npm run stylelint:fix", - "git add ." + "npm run stylelint:fix" ] } } diff --git a/src/config/global.ts b/src/config/global.ts index 5ea972f..67aba60 100644 --- a/src/config/global.ts +++ b/src/config/global.ts @@ -1,2 +1 @@ export const prefix = 'tdesign-starter'; -export const TOKEN_NAME = 'tdesign-starter'; diff --git a/src/constants/index.ts b/src/constants/index.ts index 7c822ce..4438b88 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -34,12 +34,14 @@ export const CONTRACT_PAYMENT_TYPES = { RECEIPT: 1, }; -// 通知的优先级对应的TAG类型 -export const NOTIFICATION_TYPES = { - low: 'primary', - middle: 'warning', - high: 'danger', -}; +// 标签类型 +type TagTheme = 'default' | 'success' | 'primary' | 'warning' | 'danger'; +// 通知的优先级对应的标签类型 +export const NOTIFICATION_TYPES: Map = new Map([ + ['low', 'primary'], + ['middle', 'warning'], + ['high', 'danger'], +]); // 通用请求头 export enum ContentTypeEnum { diff --git a/src/hooks/index.ts b/src/hooks/index.ts index fe47d70..3c26653 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -39,7 +39,7 @@ export const useChart = (domId: string): Ref => { * @returns */ export const useCounter = (duration = 60): [Ref, () => void] => { - let intervalTimer; + let intervalTimer: ReturnType; onUnmounted(() => { clearInterval(intervalTimer); }); diff --git a/src/layouts/components/Header.vue b/src/layouts/components/Header.vue index c74bce7..69bf443 100644 --- a/src/layouts/components/Header.vue +++ b/src/layouts/components/Header.vue @@ -141,7 +141,7 @@ const changeCollapsed = () => { }); }; -const handleNav = (url) => { +const handleNav = (url: string) => { router.push(url); }; diff --git a/src/layouts/components/LayoutContent.vue b/src/layouts/components/LayoutContent.vue index 32c1c57..c0bf5ad 100644 --- a/src/layouts/components/LayoutContent.vue +++ b/src/layouts/components/LayoutContent.vue @@ -24,7 +24,7 @@ :min-column-width="128" :popup-props="{ overlayClassName: 'route-tabs-dropdown', - onVisibleChange: (visible, ctx) => handleTabMenuClick(visible, ctx, routeItem.path), + onVisibleChange: (visible: boolean, ctx: PopupVisibleChangeContext) => handleTabMenuClick(visible, ctx, routeItem.path), visible: activeTabPath === routeItem.path, }" > @@ -70,12 +70,13 @@ diff --git a/src/pages/detail/secondary/index.vue b/src/pages/detail/secondary/index.vue index cde49dc..04b336f 100644 --- a/src/pages/detail/secondary/index.vue +++ b/src/pages/detail/secondary/index.vue @@ -6,7 +6,7 @@

- + {{ item.type }} {{ item.content }} diff --git a/src/pages/form/base/constants.ts b/src/pages/form/base/constants.ts index e321b9d..e8503a0 100644 --- a/src/pages/form/base/constants.ts +++ b/src/pages/form/base/constants.ts @@ -1,4 +1,4 @@ -import { FormRule } from 'tdesign-vue-next'; +import type { FormRule, UploadFile } from 'tdesign-vue-next'; export const FORM_RULES: Record = { name: [{ required: true, message: '请输入合同名称', type: 'error' }], @@ -23,7 +23,7 @@ export const INITIAL_DATA = { payment: '1', amount: 0, comment: '', - files: [], + files: [] as Array, }; export const TYPE_OPTIONS = [ diff --git a/src/pages/form/base/index.vue b/src/pages/form/base/index.vue index 267fdd2..514876d 100644 --- a/src/pages/form/base/index.vue +++ b/src/pages/form/base/index.vue @@ -164,6 +164,7 @@ export default { diff --git a/src/pages/form/step/index.vue b/src/pages/form/step/index.vue index 7d446be..0f0736a 100644 --- a/src/pages/form/step/index.vue +++ b/src/pages/form/step/index.vue @@ -29,7 +29,7 @@ :data="formData1" :rules="FORM_RULES" label-align="right" - @submit="(result) => onSubmit(result, 1)" + @submit="(result: SubmitContext) => onSubmit(result, 1)" > @@ -59,7 +59,7 @@ :rules="FORM_RULES" label-align="left" @reset="onReset(0)" - @submit="(result) => onSubmit(result, 2)" + @submit="(result: SubmitContext) => onSubmit(result, 2)" > @@ -96,7 +96,7 @@ :rules="FORM_RULES" label-align="left" @reset="onReset(1)" - @submit="(result) => onSubmit(result, 6)" + @submit="(result: SubmitContext) => onSubmit(result, 6)" > @@ -147,7 +147,7 @@ export default { diff --git a/src/pages/list/components/CommonTable.vue b/src/pages/list/components/CommonTable.vue index 0323863..8df81d0 100644 --- a/src/pages/list/components/CommonTable.vue +++ b/src/pages/list/components/CommonTable.vue @@ -122,7 +122,7 @@ import { useSettingStore } from '@/store'; const store = useSettingStore(); -const COLUMNS: PrimaryTableCol[] = [ +const COLUMNS: PrimaryTableCol[] = [ { title: '合同名称', fixed: 'left', @@ -167,8 +167,8 @@ const COLUMNS: PrimaryTableCol[] = [ const searchForm = { name: '', - no: undefined, - status: undefined, + no: '', + status: typeof CONTRACT_STATUS, type: '', }; @@ -233,24 +233,24 @@ onMounted(() => { fetchData(); }); -const handleClickDelete = ({ row }) => { - deleteIdx.value = row.rowIndex; +const handleClickDelete = (slot: { row: { rowIndex: number } }) => { + deleteIdx.value = slot.row.rowIndex; confirmVisible.value = true; }; -const onReset = (val) => { +const onReset = (val: unknown) => { console.log(val); }; -const onSubmit = (val) => { +const onSubmit = (val: unknown) => { console.log(val); }; const rehandlePageChange = (pageInfo: PageInfo, newDataSource: TableRowData[]) => { console.log('分页变化', pageInfo, newDataSource); }; -const rehandleChange = (changeParams, triggerAndData) => { +const rehandleChange = (changeParams: unknown, triggerAndData: unknown) => { console.log('统一Change', changeParams, triggerAndData); }; -const rehandleClickOp = ({ text, row }) => { - console.log(text, row); +const rehandleClickOp = (ctx: unknown) => { + console.log(ctx); }; const headerAffixedTop = computed( diff --git a/src/pages/list/tree/index.vue b/src/pages/list/tree/index.vue index 7101634..16b73c0 100644 --- a/src/pages/list/tree/index.vue +++ b/src/pages/list/tree/index.vue @@ -24,6 +24,7 @@ export default { diff --git a/src/pages/login/components/Login.vue b/src/pages/login/components/Login.vue index 24ba884..43339c7 100644 --- a/src/pages/login/components/Login.vue +++ b/src/pages/login/components/Login.vue @@ -80,7 +80,7 @@