From 94160c0418816e560f440e259e1f0fd4742e0143 Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Thu, 21 Dec 2023 10:50:20 +0800 Subject: [PATCH] =?UTF-8?q?types:=20=E4=BF=AE=E5=A4=8D=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B1=9E=E6=80=A7=E7=B1=BB=E5=9E=8B=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=8E=A8=E5=AF=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierignore | 1 - src/views/Example/Page/ExampleAdd.vue | 4 ++-- types/components.d.ts | 6 +++--- vite.config.ts | 29 ++++++++++++++------------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.prettierignore b/.prettierignore index 15cf07183..4ff8c9d0c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,7 +3,6 @@ /dist* /public/* /docs/* -/vite.config.ts /src/types/env.d.ts /docs/**/* /plop/**/* diff --git a/src/views/Example/Page/ExampleAdd.vue b/src/views/Example/Page/ExampleAdd.vue index 3903e219c..1c4e3b8d6 100644 --- a/src/views/Example/Page/ExampleAdd.vue +++ b/src/views/Example/Page/ExampleAdd.vue @@ -43,8 +43,8 @@ const save = async () => { {{ t('common.back') }} - - {{ t('exampleDemo.save') }} + {{ t('exampleDemo.save') }} diff --git a/types/components.d.ts b/types/components.d.ts index 8a2967eaa..15b5a6bdf 100644 --- a/types/components.d.ts +++ b/types/components.d.ts @@ -1,8 +1,8 @@ declare module 'vue' { export interface GlobalComponents { - Icon: (typeof import('../components/Icon/src/Icon.vue'))['default'] - Permission: (typeof import('../components/Permission/src/Permission.vue'))['default'] - BaseButton: (typeof import('../components/Button/src/Button.vue'))['default'] + Icon: (typeof import('../src/components/Icon/index'))['Icon'] + Permission: (typeof import('../src/components/Permission/index'))['Permission'] + BaseButton: (typeof import('../src/components/Button/index'))['BaseButton'] } } diff --git a/vite.config.ts b/vite.config.ts index 7fddf87db..38bbfda64 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,10 +5,10 @@ import Vue from '@vitejs/plugin-vue' import VueJsx from '@vitejs/plugin-vue-jsx' import progress from 'vite-plugin-progress' import EslintPlugin from 'vite-plugin-eslint' -import { ViteEjsPlugin } from "vite-plugin-ejs" +import { ViteEjsPlugin } from 'vite-plugin-ejs' import { viteMockServe } from 'vite-plugin-mock' import PurgeIcons from 'vite-plugin-purge-icons' -import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite" +import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import' import UnoCSS from 'unocss/vite' @@ -24,7 +24,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { let env = {} as any const isBuild = command === 'build' if (!isBuild) { - env = loadEnv((process.argv[3] === '--mode' ? process.argv[4] : process.argv[3]), root) + env = loadEnv(process.argv[3] === '--mode' ? process.argv[4] : process.argv[3], root) } else { env = loadEnv(mode, root) } @@ -41,16 +41,18 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { progress(), createStyleImportPlugin({ resolves: [ElementPlusResolve()], - libs: [{ - libraryName: 'element-plus', - esModule: true, - resolveStyle: (name) => { - if (name === 'click-outside') { - return '' + libs: [ + { + libraryName: 'element-plus', + esModule: true, + resolveStyle: (name) => { + if (name === 'click-outside') { + return '' + } + return `element-plus/es/components/${name.replace(/^el-/, '')}/style/css` } - return `element-plus/es/components/${name.replace(/^el-/, '')}/style/css` } - }] + ] }), EslintPlugin({ cache: false, @@ -81,8 +83,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { ViteEjsPlugin({ title: env.VITE_APP_TITLE }), - UnoCSS(), - // sveltekit(), + UnoCSS() ], css: { @@ -125,7 +126,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { '/api': { target: 'http://127.0.0.1:8000', changeOrigin: true, - rewrite: path => path.replace(/^\/api/, '') + rewrite: (path) => path.replace(/^\/api/, '') } }, hmr: {