From 1d5133b6957d95c0c2b1e9641f21a03d9a1c85bb Mon Sep 17 00:00:00 2001 From: ahaos <8406649+lhailgl@user.noreply.gitee.com> Date: 星期四, 14 十二月 2023 16:17:12 +0800 Subject: [PATCH] !69 修复升级依赖带来的类型问题 * fix 修复变量问题 * Merge remote-tracking branch 'origin/dev' into dev * update 依赖升级 * update 依赖升级 * Merge remote-tracking branch 'origin/dev' into dev * 升级依赖 * Merge remote-tracking branch 'origin/ts' into ts * 升级依赖 * Merge branch 'dev' of gitee.com:JavaLionLi/plus-ui into ts * 升级依赖 * !61 fix: 删除重复环境变量ElUploadInstance * fix: 删除重复环境变量ElUploadInstance --- .gitignore | 1 src/types/element.d.ts | 2 src/views/system/user/profile/userAvatar.vue | 5 src/types/global.d.ts | 3 src/components/Editor/index.vue | 7 + src/views/monitor/operlog/index.vue | 2 src/views/system/user/profile/thirdParty.vue | 6 src/layout/components/InnerLink/index.vue | 2 vite/plugins/unocss.ts | 7 - .eslintrc.js | 2 src/views/system/role/selectUser.vue | 3 src/layout/components/Sidebar/index.vue | 5 vite/plugins/index.ts | 20 ++-- src/layout/components/Sidebar/SidebarItem.vue | 3 src/components/ImageUpload/index.vue | 5 src/types/router.d.ts | 1 src/store/modules/tagsView.ts | 4 src/types/env.d.ts | 54 ---------- src/layout/components/TagsView/index.vue | 8 src/views/monitor/online/index.vue | 1 src/types/axios.d.ts | 2 uno.config.ts | 33 ++++++ src/components/Breadcrumb/index.vue | 4 src/types/module.d.ts | 5 + src/main.ts | 2 src/permission.ts | 7 /dev/null | 4 src/utils/index.ts | 2 src/views/system/user/index.vue | 9 + src/views/tool/gen/genInfoForm.vue | 9 + tsconfig.json | 8 + src/views/system/user/profile/userInfo.vue | 5 src/layout/components/TagsView/ScrollPane.vue | 1 vite/plugins/compression.ts | 4 src/utils/ruoyi.ts | 2 src/components/FileUpload/index.vue | 9 + src/components/ImagePreview/index.vue | 2 37 files changed, 124 insertions(+), 125 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index f6069c7..6042c39 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -22,6 +22,8 @@ rules: { '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-this-alias': 'off', // vue 'vue/multi-word-component-names': 'off', diff --git a/.gitignore b/.gitignore index 40df474..1fd56f0 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ package-lock.json yarn.lock +pnpm-lock.yaml # 缂栬瘧鐢熸垚鐨勬枃浠� auto-imports.d.ts diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 57a30ac..9502e60 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -33,9 +33,9 @@ } return name.trim() === 'Index'; }; -const handleLink = (item: RouteLocationMatched) => { +const handleLink = (item) => { const { redirect, path } = item; - redirect ? router.push(redirect as string) : router.push(path); + redirect ? router.push(redirect) : router.push(path); }; watchEffect(() => { diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index 44dee6d..05b574f 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -27,10 +27,13 @@ </template> <script setup lang="ts"> -import { QuillEditor, Quill } from '@vueup/vue-quill'; import '@vueup/vue-quill/dist/vue-quill.snow.css'; + +import { QuillEditor, Quill } from '@vueup/vue-quill'; import { propTypes } from '@/utils/propTypes'; import { globalHeaders } from '@/utils/request'; + +defineEmits(['update:modelValue']); const props = defineProps({ /* 缂栬緫鍣ㄧ殑鍐呭 */ @@ -55,7 +58,7 @@ }); const quillEditorRef = ref(); -const options = ref({ +const options = ref<any>({ theme: 'snow', bounds: document.body, debug: 'warn', diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 67abaab..1cbf395 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -48,7 +48,10 @@ import { globalHeaders } from '@/utils/request'; const props = defineProps({ - modelValue: [String, Object, Array], + modelValue: { + type: [String, Object, Array], + default: () => [] + }, // 鏁伴噺闄愬埗 limit: propTypes.number.def(5), // 澶у皬闄愬埗(MB) @@ -79,11 +82,11 @@ if (val) { let temp = 1; // 棣栧厛灏嗗�艰浆涓烘暟缁� - let list = []; + let list: any[] = []; if (Array.isArray(val)) { list = val; } else { - const res = await listByIds(val as string); + const res = await listByIds(val); list = res.data.map((oss) => { const data = { name: oss.originalName, diff --git a/src/components/ImagePreview/index.vue b/src/components/ImagePreview/index.vue index 31bf873..5543923 100644 --- a/src/components/ImagePreview/index.vue +++ b/src/components/ImagePreview/index.vue @@ -33,7 +33,7 @@ const realSrcList = computed(() => { if (!props.src) { - return; + return []; } let real_src_list = props.src.split(','); let srcList: string[] = []; diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index 47945dd..6b7a39b 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -46,7 +46,10 @@ import { globalHeaders } from '@/utils/request'; const props = defineProps({ - modelValue: [String, Object, Array], + modelValue: { + type: [String, Object, Array], + default: () => [] + }, // 鍥剧墖鏁伴噺闄愬埗 limit: propTypes.number.def(5), // 澶у皬闄愬埗(MB) diff --git a/src/layout/components/InnerLink/index.vue b/src/layout/components/InnerLink/index.vue index b80b17b..bb6b89b 100644 --- a/src/layout/components/InnerLink/index.vue +++ b/src/layout/components/InnerLink/index.vue @@ -1,6 +1,6 @@ <template> <div :style="'height:' + height"> - <iframe :id="iframeId" style="width: 100%; height: 100%" :src="src" frameborder="no"></iframe> + <iframe :id="iframeId" style="width: 100%; height: 100%; border: 0" :src="src"></iframe> </div> </template> diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 7829d18..3720062 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -36,7 +36,6 @@ import { RouteRecordRaw } from 'vue-router'; const props = defineProps({ - // route object item: { type: Object as PropType<RouteRecordRaw>, required: true @@ -85,7 +84,7 @@ if (isExternal(routePath)) { return routePath; } - if (isExternal(props.basePath)) { + if (isExternal(props.basePath as string)) { return props.basePath; } if (routeQuery) { diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index a8f47e2..a905c70 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -13,7 +13,7 @@ :collapse-transition="false" mode="vertical" > - <sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route" :base-path="route.path" /> + <sidebar-item v-for="(r, index) in sidebarRouters" :key="r.path + index" :item="r" :base-path="r.path" /> </el-menu> </transition> </el-scrollbar> @@ -28,7 +28,8 @@ import useSettingsStore from '@/store/modules/settings'; import usePermissionStore from '@/store/modules/permission'; import { RouteRecordRaw } from 'vue-router'; -const { proxy } = getCurrentInstance() as ComponentInternalInstance; + +const { proxy } = getCurrentInstance(); const route = useRoute(); const appStore = useAppStore(); diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue index a8e2ebc..2223070 100644 --- a/src/layout/components/TagsView/ScrollPane.vue +++ b/src/layout/components/TagsView/ScrollPane.vue @@ -7,6 +7,7 @@ <script setup lang="ts"> import useTagsViewStore from '@/store/modules/tagsView'; import { TagView } from 'vue-router'; + const tagAndTagSpacing = ref(4); const scrollContainerRef = ref<ElScrollbarInstance>(); diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 6b99675..0e23caa 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -143,7 +143,7 @@ scrollPaneRef.value?.moveToTarget(r); // when query is different then update if (r.fullPath !== route.fullPath) { - useTagsViewStore().updateVisitedView(route); + useTagsViewStore().updateVisitedView(route as any); } } } @@ -163,14 +163,14 @@ }); }; const closeRightTags = () => { - proxy?.$tab.closeRightPage(selectedTag.value).then((visitedViews) => { - if (!visitedViews.find((i) => i.fullPath === route.fullPath)) { + proxy?.$tab.closeRightPage(selectedTag.value).then((visitedViews: TagView[]) => { + if (!visitedViews.find((i: TagView) => i.fullPath === route.fullPath)) { toLastView(visitedViews); } }); }; const closeLeftTags = () => { - proxy?.$tab.closeLeftPage(selectedTag.value).then((visitedViews) => { + proxy?.$tab.closeLeftPage(selectedTag.value).then((visitedViews: TagView[]) => { if (!visitedViews.find((i: TagView) => i.fullPath === route.fullPath)) { toLastView(visitedViews); } diff --git a/src/main.ts b/src/main.ts index 7d5d153..439d82c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue'; // global css -import 'uno.css'; +import 'virtual:uno.css'; import '@/assets/styles/index.scss'; import 'element-plus/theme-chalk/dark/css-vars.css'; diff --git a/src/permission.ts b/src/permission.ts index 2fc105b..69795f8 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -8,7 +8,6 @@ import useUserStore from '@/store/modules/user'; import useSettingsStore from '@/store/modules/settings'; import usePermissionStore from '@/store/modules/permission'; -import { RouteRecordRaw } from 'vue-router'; NProgress.configure({ showSpinner: false }); const whiteList = ['/login', '/register', '/social-callback']; @@ -36,12 +35,14 @@ isRelogin.show = false; const accessRoutes = await usePermissionStore().generateRoutes(); // 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛� - accessRoutes.forEach((route: RouteRecordRaw) => { + accessRoutes.forEach((route) => { if (!isHttp(route.path)) { router.addRoute(route); // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛� } }); - next({ ...to, replace: true }); // hack鏂规硶 纭繚addRoutes宸插畬鎴� + const n = { ...to, replace: true }; + console.log(n); + next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack鏂规硶 纭繚addRoutes宸插畬鎴� } } else { next(); diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts index 7014cd9..2735a05 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -123,7 +123,7 @@ }); }; - const updateVisitedView = (view: TagView | RouteLocationNormalized): void => { + const updateVisitedView = (view: TagView): void => { for (let v of visitedViews.value) { if (v.path === view.path) { v = Object.assign(v, view); @@ -170,7 +170,7 @@ }); }; - const addCachedView = (view: TagView | RouteLocationNormalized): void => { + const addCachedView = (view: TagView): void => { const viewName = view.name as string; if (!viewName) return; if (cachedViews.value.includes(viewName)) return; diff --git a/src/types/axios.d.ts b/src/types/axios.d.ts index 36a9f8f..2451f2a 100644 --- a/src/types/axios.d.ts +++ b/src/types/axios.d.ts @@ -1,7 +1,7 @@ import axios from 'axios'; declare module 'axios' { - export interface AxiosResponse<T = any> { + interface AxiosResponse<T = any> { code: number; msg: string; rows: T; diff --git a/src/types/element.d.ts b/src/types/element.d.ts index 13fb8db..6a7bdef 100644 --- a/src/types/element.d.ts +++ b/src/types/element.d.ts @@ -4,6 +4,7 @@ declare type ElFormInstance = ep.FormInstance; declare type ElTableInstance = ep.TableInstance; declare type ElUploadInstance = ep.UploadInstance; + declare type ElScrollbarInstance = ep.ScrollbarInstance; declare type ElTreeInstance = InstanceType<typeof ep.ElTree>; declare type ElTreeSelectInstance = InstanceType<typeof ep.ElTreeSelect>; declare type ElSelectInstance = InstanceType<typeof ep.ElSelect>; @@ -24,7 +25,6 @@ declare type ElColorPickerInstance = InstanceType<typeof ep.ElColorPicker>; declare type ElRateInstance = InstanceType<typeof ep.ElRate>; declare type ElSliderInstance = InstanceType<typeof ep.ElSlider>; - declare type ElScrollbarInstance = InstanceType<typeof ep.ElScrollbar>; declare type TransferKey = ep.TransferKey; declare type CheckboxValueType = ep.CheckboxValueType; diff --git a/src/types/env.d.ts b/src/types/env.d.ts index b521b38..6667d05 100644 --- a/src/types/env.d.ts +++ b/src/types/env.d.ts @@ -4,60 +4,6 @@ export default Component; } -declare module '*.avif' { - const src: string; - export default src; -} - -declare module '*.bmp' { - const src: string; - export default src; -} - -declare module '*.gif' { - const src: string; - export default src; -} - -declare module '*.jpg' { - const src: string; - export default src; -} - -declare module '*.jpeg' { - const src: string; - export default src; -} - -declare module '*.png' { - const src: string; - export default src; -} - -declare module '*.webp' { - const src: string; - export default src; -} - -declare module '*.svg' { - const src: string; - export default src; -} - -declare module '*.module.css' { - const classes: { readonly [key: string]: string }; - export default classes; -} - -declare module '*.module.scss' { - const classes: { readonly [key: string]: string }; - export default classes; -} - -declare module '*.module.sass' { - const classes: { readonly [key: string]: string }; - export default classes; -} // 鐜鍙橀噺 interface ImportMetaEnv { VITE_APP_TITLE: string; diff --git a/src/types/global.d.ts b/src/types/global.d.ts index c6cb210..10cc438 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -1,4 +1,5 @@ -import type { ComponentInternalInstance as ComponentInstance, PropType as VuePropType } from 'vue/runtime-core'; +import type { ComponentInternalInstance as ComponentInstance } from 'vue/runtime-core'; +import type { PropType as VuePropType } from 'vue'; import { LanguageEnum } from '@/enums/LanguageEnum'; declare global { diff --git a/src/types/module.d.ts b/src/types/module.d.ts index b1be08d..16b1116 100644 --- a/src/types/module.d.ts +++ b/src/types/module.d.ts @@ -30,3 +30,8 @@ parseTime: typeof parseTime; } } + +declare module 'vform3-builds' { + const content: any; + export = content; +} diff --git a/src/types/router.d.ts b/src/types/router.d.ts index b161040..f920921 100644 --- a/src/types/router.d.ts +++ b/src/types/router.d.ts @@ -16,6 +16,7 @@ roles?: string[]; alwaysShow?: boolean; query?: string; + parentPath?: string; } interface _RouteLocationBase { diff --git a/src/types/vform3-builds.d.ts b/src/types/vform3-builds.d.ts deleted file mode 100644 index 82573de..0000000 --- a/src/types/vform3-builds.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module 'vform3-builds' { - const content: any; - export = content; -} diff --git a/src/utils/index.ts b/src/utils/index.ts index f474462..2b0aad5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -89,7 +89,7 @@ * @returns {Array} */ export const cleanArray = (actual: Array<any>) => { - const newArray = []; + const newArray: any[] = []; for (let i = 0; i < actual.length; i++) { if (actual[i]) { newArray.push(actual[i]); diff --git a/src/utils/ruoyi.ts b/src/utils/ruoyi.ts index bbba282..8efd12c 100644 --- a/src/utils/ruoyi.ts +++ b/src/utils/ruoyi.ts @@ -68,7 +68,7 @@ if (value === undefined) { return ''; } - const actions = []; + const actions: Array<string | number> = []; Object.keys(datas).some((key) => { if (datas[key].value == '' + value) { actions.push(datas[key].label); diff --git a/src/views/monitor/online/index.vue b/src/views/monitor/online/index.vue index 6bde45c..27de613 100644 --- a/src/views/monitor/online/index.vue +++ b/src/views/monitor/online/index.vue @@ -63,6 +63,7 @@ <script setup name="Online" lang="ts"> import { forceLogout, list as initData } from '@/api/monitor/online'; import { OnlineQuery, OnlineVO } from '@/api/monitor/online/types'; +import api from '@/api/system/user'; import { to } from 'await-to-js'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; diff --git a/src/views/monitor/operlog/index.vue b/src/views/monitor/operlog/index.vue index e4eda79..4316fbf 100644 --- a/src/views/monitor/operlog/index.vue +++ b/src/views/monitor/operlog/index.vue @@ -1,7 +1,7 @@ <template> <div class="p-2"> <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> - <div class="mb-[10px]"> + <div v-show="showSearch" class="mb-[10px]"> <el-card shadow="hover"> <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px"> <el-form-item label="鎿嶄綔鍦板潃" prop="operIp"> diff --git a/src/views/system/role/selectUser.vue b/src/views/system/role/selectUser.vue index f6c1000..ec7a257 100644 --- a/src/views/system/role/selectUser.vue +++ b/src/views/system/role/selectUser.vue @@ -50,7 +50,8 @@ const props = defineProps({ roleId: { - type: [Number, String] + type: [Number, String], + required: true } }); diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 56078d9..a952954 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -372,7 +372,8 @@ postIds: [], roleIds: [] }; -const data = reactive<PageData<UserForm, UserQuery>>({ + +const initData: PageData<UserForm, UserQuery> = { form: { ...initFormData }, queryParams: { pageNum: 1, @@ -380,7 +381,8 @@ userName: '', phonenumber: '', status: '', - deptId: '' + deptId: '', + roleId: '' }, rules: { userName: [ @@ -417,7 +419,8 @@ } ] } -}); +}; +const data = reactive<PageData<UserForm, UserQuery>>(initData); const { queryParams, form, rules } = toRefs<PageData<UserForm, UserQuery>>(data); diff --git a/src/views/system/user/profile/thirdParty.vue b/src/views/system/user/profile/thirdParty.vue index 7cdbea9..47ad707 100644 --- a/src/views/system/user/profile/thirdParty.vue +++ b/src/views/system/user/profile/thirdParty.vue @@ -51,14 +51,12 @@ <script lang="ts" setup> import { authUnlock, authBinding } from '@/api/system/social/auth'; -import { PropType } from 'vue'; +import { propTypes } from '@/utils/propTypes'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const props = defineProps({ - auths: { - type: Object as PropType<any> - } + auths: propTypes.any.isRequired }); const auths = computed(() => props.auths); diff --git a/src/views/system/user/profile/userAvatar.vue b/src/views/system/user/profile/userAvatar.vue index e0fe20d..32b6f5c 100644 --- a/src/views/system/user/profile/userAvatar.vue +++ b/src/views/system/user/profile/userAvatar.vue @@ -60,6 +60,7 @@ import { VueCropper } from 'vue-cropper'; import { uploadAvatar } from '@/api/system/user'; import useUserStore from '@/store/modules/user'; +import { UploadRawFile } from 'element-plus'; interface Options { img: string | any; // 瑁佸壀鍥剧墖鐨勫湴鍧� @@ -118,7 +119,7 @@ cropper.value.changeScale(num); }; /** 涓婁紶棰勫鐞� */ -const beforeUpload = (file: any) => { +const beforeUpload = (file: UploadRawFile): any => { if (file.type.indexOf('image/') == -1) { proxy?.$modal.msgError('鏂囦欢鏍煎紡閿欒锛岃涓婁紶鍥剧墖绫诲瀷,濡傦細JPG锛孭NG鍚庣紑鐨勬枃浠躲��'); } else { @@ -138,7 +139,7 @@ const res = await uploadAvatar(formData); open.value = false; options.img = res.data.imgUrl; - userStore.setAvatar(options.img as string); + userStore.setAvatar(options.img); proxy?.$modal.msgSuccess('淇敼鎴愬姛'); visible.value = false; }); diff --git a/src/views/system/user/profile/userInfo.vue b/src/views/system/user/profile/userInfo.vue index 885f1c9..289f8d4 100644 --- a/src/views/system/user/profile/userInfo.vue +++ b/src/views/system/user/profile/userInfo.vue @@ -32,7 +32,7 @@ const userForm = computed(() => props.user); const { proxy } = getCurrentInstance() as ComponentInternalInstance; const userRef = ref<ElFormInstance>(); -const rules = ref<ElFormRules>({ +const rule: ElFormRules = { nickName: [{ required: true, message: '鐢ㄦ埛鏄电О涓嶈兘涓虹┖', trigger: 'blur' }], email: [ { required: true, message: '閭鍦板潃涓嶈兘涓虹┖', trigger: 'blur' }, @@ -50,7 +50,8 @@ }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '璇疯緭鍏ユ纭殑鎵嬫満鍙风爜', trigger: 'blur' } ] -}); +}; +const rules = ref<ElFormRules>(rule); /** 鎻愪氦鎸夐挳 */ const submit = () => { diff --git a/src/views/tool/gen/genInfoForm.vue b/src/views/tool/gen/genInfoForm.vue index ad8fd5e..a8d7e13 100644 --- a/src/views/tool/gen/genInfoForm.vue +++ b/src/views/tool/gen/genInfoForm.vue @@ -228,16 +228,16 @@ interface MenuOptionsType { menuId: number | string; menuName: string; - children: MenuOptionsType[] | undefined; + children?: MenuOptionsType[]; } +const { proxy } = getCurrentInstance(); const subColumns = ref<any>([]); const menuOptions = ref<Array<MenuOptionsType>>([]); -const { proxy } = getCurrentInstance(); const props = defineProps({ - info: propTypes.any.def(null), - tables: propTypes.any.def(null) + info: propTypes.any.isRequired, + tables: propTypes.any.isRequired }); const infoForm = computed(() => props.info); @@ -276,6 +276,7 @@ const res = await listMenu(); res.data.forEach((m) => (m.menuId = m.menuId.toString())); const data = proxy?.handleTree<MenuOptionsType>(res.data, 'menuId'); + if (data) { menuOptions.value = data; } diff --git a/tsconfig.json b/tsconfig.json index cadd083..b3c0a01 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,21 +2,25 @@ "compilerOptions": { "target": "esnext", "module": "esnext", - "useDefineForClassFields": true, - "moduleResolution": "node", +// "useDefineForClassFields": true, + "moduleResolution": "bundler", "strict": true, "jsx": "preserve", "sourceMap": true, "resolveJsonModule": true, "esModuleInterop": true, + "strictFunctionTypes": false, "lib": ["esnext", "dom"], + "noImplicitAny": false, "baseUrl": ".", "allowJs": true, + "experimentalDecorators": true, "paths": { "@/*": ["src/*"] }, "types": ["vite/client"], "skipLibCheck": true, + "removeComments": true, // 鍏佽榛樿瀵煎叆 "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true diff --git a/uno.config.ts b/uno.config.ts new file mode 100644 index 0000000..0c60a22 --- /dev/null +++ b/uno.config.ts @@ -0,0 +1,33 @@ +import { + defineConfig, + presetAttributify, + presetIcons, + presetTypography, + presetUno, + presetWebFonts, + transformerDirectives, + transformerVariantGroup +} from 'unocss'; + +export default defineConfig({ + shortcuts: { + 'panel-title': + 'pb-[5px] font-sans leading-[1.1] font-medium text-base text-[#6379bb] border-b border-b-solid border-[var(--el-border-color-light)] mb-5 mt-0' + }, + theme: { + colors: { + primary: 'var(--el-color-primary)', + primary_dark: 'var(--el-color-primary-light-5)' + } + }, + presets: [ + presetUno(), + presetAttributify(), + presetIcons(), + presetTypography(), + presetWebFonts({ + fonts: {} + }) + ], + transformers: [transformerDirectives(), transformerVariantGroup()] +}); diff --git a/vite/plugins/compression.ts b/vite/plugins/compression.ts index 123ff3a..aa8c779 100644 --- a/vite/plugins/compression.ts +++ b/vite/plugins/compression.ts @@ -1,6 +1,6 @@ import compression from 'vite-plugin-compression'; -export default function createCompression(env: any) { +export default (env: any) => { const { VITE_BUILD_COMPRESS } = env; const plugin: any[] = []; if (VITE_BUILD_COMPRESS) { @@ -25,4 +25,4 @@ } } return plugin; -} +}; diff --git a/vite/plugins/index.ts b/vite/plugins/index.ts index a31412d..30b2835 100644 --- a/vite/plugins/index.ts +++ b/vite/plugins/index.ts @@ -9,14 +9,14 @@ import path from 'path'; export default (viteEnv: any, isBuild = false): [] => { - const vitePlusgins: any = []; - vitePlusgins.push(vue()); - vitePlusgins.push(createUnoCss()); - vitePlusgins.push(createAutoImport(path)); - vitePlusgins.push(createComponents(path)); - vitePlusgins.push(createCompression(viteEnv)); - vitePlusgins.push(createIcons()); - vitePlusgins.push(createSvgIconsPlugin(path, isBuild)); - vitePlusgins.push(createSetupExtend()); - return vitePlusgins; + const vitePlugins: any = []; + vitePlugins.push(vue()); + vitePlugins.push(createUnoCss()); + vitePlugins.push(createAutoImport(path)); + vitePlugins.push(createComponents(path)); + vitePlugins.push(createCompression(viteEnv)); + vitePlugins.push(createIcons()); + vitePlugins.push(createSvgIconsPlugin(path, isBuild)); + vitePlugins.push(createSetupExtend()); + return vitePlugins; }; diff --git a/vite/plugins/unocss.ts b/vite/plugins/unocss.ts index 76585c7..08e186b 100644 --- a/vite/plugins/unocss.ts +++ b/vite/plugins/unocss.ts @@ -1,14 +1,7 @@ import UnoCss from 'unocss/vite'; -import { presetUno, presetAttributify, presetIcons } from 'unocss'; export default () => { return UnoCss({ - presets: [presetUno(), presetAttributify(), presetIcons()], - // rules: [['search', {}]], - shortcuts: { - 'panel-title': - 'pb-[5px] font-sans leading-[1.1] font-medium text-base text-[#6379bb] border-b border-b-solid border-[var(--el-border-color-light)] mb-5 mt-0' - }, hmrTopLevelAwait: false // unocss榛樿鏄痶rue锛屼綆鐗堟湰娴忚鍣ㄦ槸涓嶆敮鎸佺殑锛屽惎鍔ㄥ悗浼氭姤閿� }); }; -- Gitblit v1.9.3