From f3593c453a8b8d5eb8cbd0ed5402132b027461b9 Mon Sep 17 00:00:00 2001 From: walkInALine <478207401@qq.com> Date: Mon, 18 Dec 2023 15:15:32 +0800 Subject: [PATCH 01/19] =?UTF-8?q?fix:=20useClipboard=E5=9C=A8ip=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E4=B8=8B=E4=B8=8D=E8=83=BD=E4=BD=BF=E7=94=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Setting/src/Setting.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Setting/src/Setting.vue b/src/components/Setting/src/Setting.vue index 8d2cbba..3581761 100644 --- a/src/components/Setting/src/Setting.vue +++ b/src/components/Setting/src/Setting.vue @@ -174,7 +174,8 @@ const copyConfig = async () => { // 头部边框颜色 topToolBorderColor: '${appStore.getTheme.topToolBorderColor}' } - ` + `, + legacy: true }) if (!isSupported) { ElMessage.error(t('setting.copyFailed')) From 1c63757d55076d15ffdf21d647de393ca3c6b0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=B4=A2=E5=AF=8C?= <1501583478@qq.com> Date: Mon, 18 Dec 2023 16:47:21 +0800 Subject: [PATCH 02/19] =?UTF-8?q?fix:=20Menu=E8=8F=9C=E5=8D=95=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=98=BE=E7=A4=BAbug=EF=BC=8CrenderMenuItem=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=9A=84=E6=95=B0=E7=BB=84=E5=AD=98=E5=9C=A8undefined?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E5=AF=BC=E8=87=B4=E7=9C=81=E7=95=A5?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Menu/src/components/useRenderMenuItem.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Menu/src/components/useRenderMenuItem.tsx b/src/components/Menu/src/components/useRenderMenuItem.tsx index d7fede2..3a33922 100644 --- a/src/components/Menu/src/components/useRenderMenuItem.tsx +++ b/src/components/Menu/src/components/useRenderMenuItem.tsx @@ -12,9 +12,10 @@ export const useRenderMenuItem = ( menuMode: 'vertical' | 'horizontal' ) => { const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => { - return routers.map((v) => { - const meta = v.meta ?? {} - if (!meta.hidden) { + return routers + .filter((v) => !v.meta?.hidden) + .map((v) => { + const meta = v.meta ?? {} const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v) const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath(allRouters, v.path).join('/') @@ -48,8 +49,7 @@ export const useRenderMenuItem = ( ) } - } - }) + }) } return { From bf2cd720d0e5801603848a0b1520a928443ac549 Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Tue, 19 Dec 2023 09:04:07 +0800 Subject: [PATCH 03/19] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Drequest=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E8=87=AA=E5=AE=9A=E4=B9=89headers=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/axios/config.ts | 4 ++-- types/global.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/axios/config.ts b/src/axios/config.ts index d1c0a77..efdae3d 100644 --- a/src/axios/config.ts +++ b/src/axios/config.ts @@ -1,4 +1,4 @@ -import { AxiosResponse, AxiosRequestHeaders, InternalAxiosRequestConfig } from './types' +import { AxiosResponse, InternalAxiosRequestConfig } from './types' import { ElMessage } from 'element-plus' import qs from 'qs' import { SUCCESS_CODE } from '@/constants' @@ -7,7 +7,7 @@ import { useUserStoreWithOut } from '@/store/modules/user' const defaultRequestInterceptors = (config: InternalAxiosRequestConfig) => { if ( config.method === 'post' && - (config.headers as AxiosRequestHeaders)['Content-Type'] === 'application/x-www-form-urlencoded' + config.headers['Content-Type'] === 'application/x-www-form-urlencoded' ) { config.data = qs.stringify(config.data) } diff --git a/types/global.d.ts b/types/global.d.ts index 595eb64..bef1d71 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -1,5 +1,5 @@ import type { CSSProperties } from 'vue' -import { AxiosRequestHeaders } from 'axios' +import { RawAxiosRequestHeaders } from 'axios' declare global { declare interface Fn { (...arg: T[]): T @@ -40,7 +40,7 @@ declare global { data?: any url?: string method?: AxiosMethod - headers?: AxiosRequestHeaders + headers?: RawAxiosRequestHeaders responseType?: AxiosResponseType } From 747c26fbcce208a109d1a719cca042ccab55dcc9 Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Tue, 19 Dec 2023 15:47:19 +0800 Subject: [PATCH 04/19] =?UTF-8?q?wip:=20=E8=A1=A8=E6=A0=BC=E5=88=97?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + .../Table/src/components/ColumnSetting.vue | 39 ++++++ .../Table/src/components/TableActions.vue | 111 ++++++++++-------- src/locales/en.ts | 4 +- src/locales/zh-CN.ts | 3 +- src/views/Components/Table/UseTableDemo.vue | 64 +++++----- 6 files changed, 139 insertions(+), 83 deletions(-) create mode 100644 src/components/Table/src/components/ColumnSetting.vue diff --git a/package.json b/package.json index 5e9e63c..14c3d45 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "qs": "^6.11.2", "url": "^0.11.3", "vue": "3.3.10", + "vue-draggable-plus": "^0.3.2", "vue-i18n": "9.8.0", "vue-json-pretty": "^2.2.4", "vue-router": "^4.2.5", diff --git a/src/components/Table/src/components/ColumnSetting.vue b/src/components/Table/src/components/ColumnSetting.vue new file mode 100644 index 0000000..41cdd68 --- /dev/null +++ b/src/components/Table/src/components/ColumnSetting.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/components/Table/src/components/TableActions.vue b/src/components/Table/src/components/TableActions.vue index 3a1856f..3d96423 100644 --- a/src/components/Table/src/components/TableActions.vue +++ b/src/components/Table/src/components/TableActions.vue @@ -1,10 +1,11 @@ diff --git a/src/components/Table/src/components/TableActions.vue b/src/components/Table/src/components/TableActions.vue index 3d96423..2eaab32 100644 --- a/src/components/Table/src/components/TableActions.vue +++ b/src/components/Table/src/components/TableActions.vue @@ -23,7 +23,7 @@ export default defineComponent({ default: () => [] } }, - emits: ['refresh', 'changSize'], + emits: ['refresh', 'changSize', 'confirm'], setup(props, { emit }) { const showSetting = ref(false) @@ -35,6 +35,10 @@ export default defineComponent({ emit('changSize', size) } + const confirm = (columns: TableColumn[]) => { + emit('confirm', columns) + } + const showColumnSetting = () => { showSetting.value = true } @@ -95,7 +99,7 @@ export default defineComponent({ /> - + ) } diff --git a/src/constants/index.ts b/src/constants/index.ts index 6f676aa..4dc2db2 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -22,3 +22,8 @@ export const NO_REDIRECT_WHITE_LIST = ['/login'] * 不重置路由白名单 */ export const NO_RESET_WHITE_LIST = ['Redirect', 'Login', 'NoFind', 'Root'] + +/** + * 表格默认过滤列设置字段 + */ +export const DEFAULT_FILTER_COLUMN = ['expand', 'selection'] diff --git a/src/views/Components/Table/UseTableDemo.vue b/src/views/Components/Table/UseTableDemo.vue index da1a754..7bcfb16 100644 --- a/src/views/Components/Table/UseTableDemo.vue +++ b/src/views/Components/Table/UseTableDemo.vue @@ -56,7 +56,8 @@ const columns = reactive([ { field: 'index', label: t('tableDemo.index'), - type: 'index' + type: 'index', + hidden: true }, { field: 'title', From 7314065c907f8ef4d184c1f3c724b67c30410ab9 Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Tue, 19 Dec 2023 19:57:45 +0800 Subject: [PATCH 06/19] =?UTF-8?q?refactor:=20=E6=96=B0=E5=A2=9E=E5=88=97?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Table/src/components/ColumnSetting.vue | 104 ++++++++++-------- src/views/Components/Table/UseTableDemo.vue | 3 +- 2 files changed, 61 insertions(+), 46 deletions(-) diff --git a/src/components/Table/src/components/ColumnSetting.vue b/src/components/Table/src/components/ColumnSetting.vue index 8f8f047..5d40b7b 100644 --- a/src/components/Table/src/components/ColumnSetting.vue +++ b/src/components/Table/src/components/ColumnSetting.vue @@ -11,6 +11,7 @@ import { TableColumn } from '../types' import { PropType, ref, watch, unref } from 'vue' import { cloneDeep } from 'lodash-es' import { DEFAULT_FILTER_COLUMN } from '@/constants' +import { VueDraggable } from 'vue-draggable-plus' const modelValue = defineModel() @@ -50,7 +51,7 @@ const confirm = () => { const newColumns = cloneDeep(unref(settingColumns))?.map((item) => { const fixed = unref(settingColumns)?.find((col) => col.field === item.field)?.fixed item.hidden = !!!unref(checkColumns)?.includes(item.field) - item.fixed = fixed !== void 0 ? fixed : undefined + item.fixed = fixed ? fixed : undefined return item }) emit('confirm', [...unref(hiddenColumns), ...(newColumns || [])]) @@ -58,21 +59,20 @@ const confirm = () => { } const restore = () => { - initColumns([...unref(hiddenColumns), ...(unref(oldColumns) || [])]) + initColumns([...unref(hiddenColumns), ...(unref(oldColumns) || [])], true) } -const initColumns = (columns: TableColumn[]) => { - const newColumns = cloneDeep( - columns?.filter((item) => { +const initColumns = (columns: TableColumn[], isReStore = false) => { + const newColumns = columns?.filter((item) => { + if (!isReStore) { item.fixed = item.fixed !== void 0 ? item.fixed : undefined - return (item.type && !DEFAULT_FILTER_COLUMN.includes(item.type)) || !item.type - }) - ) - console.log(newColumns) + } + return (item.type && !DEFAULT_FILTER_COLUMN.includes(item.type)) || !item.type + }) if (!unref(oldColumns)) { - oldColumns.value = newColumns + oldColumns.value = cloneDeep(newColumns) } - settingColumns.value = newColumns + settingColumns.value = cloneDeep(newColumns) hiddenColumns.value = cloneDeep( columns?.filter((item) => item.type && DEFAULT_FILTER_COLUMN.includes(item.type)) @@ -93,7 +93,6 @@ const initColumns = (columns: TableColumn[]) => { watch( () => props.columns, (columns) => { - console.log(columns) initColumns(columns) }, { @@ -104,40 +103,57 @@ watch( -@/hooks/event/useEmitt +@/hooks/event/useEventBus diff --git a/src/views/Example/Page/ExamplePage.vue b/src/views/Example/Page/ExamplePage.vue index 64b9804..c13fe3c 100644 --- a/src/views/Example/Page/ExamplePage.vue +++ b/src/views/Example/Page/ExamplePage.vue @@ -9,7 +9,7 @@ import { useTable } from '@/hooks/web/useTable' import { TableData } from '@/api/table/types' import { reactive, ref, unref } from 'vue' import { useRouter } from 'vue-router' -import { useEmitt } from '@/hooks/event/useEmitt' +import { useEventBus } from '@/hooks/event/useEventBus' import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas' import { BaseButton } from '@/components/Button' @@ -50,7 +50,7 @@ const { getList, getElTableExpose, delList } = tableMethods getList() -useEmitt({ +useEventBus({ name: 'getList', callback: (type: string) => { if (type === 'add') { @@ -294,4 +294,4 @@ const action = (row: TableData, type: string) => { /> -@/hooks/event/useEmitt +@/hooks/event/useEventBus From c29d1cb4c6e7ee66a708a2cebc04594363500983 Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Thu, 21 Dec 2023 10:19:49 +0800 Subject: [PATCH 09/19] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 14c3d45..6417307 100644 --- a/package.json +++ b/package.json @@ -41,50 +41,50 @@ "driver.js": "^1.3.1", "echarts": "^5.4.3", "echarts-wordcloud": "^2.1.0", - "element-plus": "^2.4.3", + "element-plus": "^2.4.4", "lodash-es": "^4.17.21", "mitt": "^3.0.1", "nprogress": "^0.2.0", "pinia": "^2.1.7", - "pinia-plugin-persistedstate": "^3.2.0", + "pinia-plugin-persistedstate": "^3.2.1", "qrcode": "^1.5.3", "qs": "^6.11.2", "url": "^0.11.3", - "vue": "3.3.10", + "vue": "3.3.13", "vue-draggable-plus": "^0.3.2", "vue-i18n": "9.8.0", - "vue-json-pretty": "^2.2.4", + "vue-json-pretty": "^2.3.0", "vue-router": "^4.2.5", "vue-types": "^5.1.1", - "xgplayer": "^3.0.10" + "xgplayer": "^3.0.11" }, "devDependencies": { "@commitlint/cli": "^18.4.3", "@commitlint/config-conventional": "^18.4.3", - "@iconify/json": "^2.2.153", - "@intlify/unplugin-vue-i18n": "^1.5.0", + "@iconify/json": "^2.2.160", + "@intlify/unplugin-vue-i18n": "^2.0.0", "@purge-icons/generated": "^0.10.0", "@types/fs-extra": "^11.0.4", "@types/inquirer": "^9.0.7", "@types/lodash-es": "^4.17.12", - "@types/node": "^20.10.3", + "@types/node": "^20.10.5", "@types/nprogress": "^0.2.3", "@types/qrcode": "^1.5.5", "@types/qs": "^6.9.10", "@types/sortablejs": "^1.15.7", - "@typescript-eslint/eslint-plugin": "^6.13.2", - "@typescript-eslint/parser": "^6.13.2", + "@typescript-eslint/eslint-plugin": "^6.15.0", + "@typescript-eslint/parser": "^6.15.0", "@unocss/transformer-variant-group": "^0.58.0", "@vitejs/plugin-legacy": "^5.2.0", - "@vitejs/plugin-vue": "^4.5.1", + "@vitejs/plugin-vue": "^4.5.2", "@vitejs/plugin-vue-jsx": "^3.1.0", "autoprefixer": "^10.4.16", "chalk": "^5.3.0", "consola": "^3.2.3", - "eslint": "^8.55.0", + "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-define-config": "^2.0.0", - "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-prettier": "^5.1.0", "eslint-plugin-vue": "^9.19.2", "esno": "^4.0.0", "fs-extra": "^11.2.0", @@ -96,18 +96,18 @@ "postcss": "^8.4.32", "postcss-html": "^1.5.0", "postcss-less": "^6.0.0", - "prettier": "^3.1.0", + "prettier": "^3.1.1", "rimraf": "^5.0.5", - "rollup": "^4.6.1", - "stylelint": "^15.11.0", + "rollup": "^4.9.1", + "stylelint": "^16.0.2", "stylelint-config-html": "^1.1.0", - "stylelint-config-recommended": "^13.0.0", - "stylelint-config-standard": "^34.0.0", - "stylelint-order": "^6.0.3", - "terser": "^5.25.0", + "stylelint-config-recommended": "^14.0.0", + "stylelint-config-standard": "^35.0.0", + "stylelint-order": "^6.0.4", + "terser": "^5.26.0", "typescript": "5.3.3", "unocss": "^0.58.0", - "vite": "5.0.6", + "vite": "5.0.10", "vite-plugin-ejs": "^1.7.0", "vite-plugin-eslint": "^1.8.1", "vite-plugin-mock": "^2.9.6", 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 10/19] =?UTF-8?q?types:=20=E4=BF=AE=E5=A4=8D=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E7=BB=84=E4=BB=B6=E5=B1=9E=E6=80=A7=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=97=A0=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 15cf071..4ff8c9d 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 3903e21..1c4e3b8 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 8a2967e..15b5a6b 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 7fddf87..38bbfda 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: { From 8aeeb0b4878dbdac66f9c9d8554e29f966be9bee Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Thu, 21 Dec 2023 11:23:41 +0800 Subject: [PATCH 11/19] =?UTF-8?q?chore:=20=E6=96=B0=E5=A2=9E=E6=89=93?= =?UTF-8?q?=E5=8C=85=E4=BD=93=E7=A7=AF=E5=88=86=E6=9E=90=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ package.json | 1 + vite.config.ts | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 0b05e6a..7f5d52e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ dist-ssr /dist* *-lock.* pnpm-debug +stats.html + diff --git a/package.json b/package.json index 6417307..3fbe900 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "prettier": "^3.1.1", "rimraf": "^5.0.5", "rollup": "^4.9.1", + "rollup-plugin-visualizer": "^5.11.0", "stylelint": "^16.0.2", "stylelint-config-html": "^1.1.0", "stylelint-config-recommended": "^14.0.0", diff --git a/vite.config.ts b/vite.config.ts index 38bbfda..618a31e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,6 +12,7 @@ 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' +import { visualizer } from 'rollup-plugin-visualizer' // https://vitejs.dev/config/ const root = process.cwd() @@ -117,6 +118,9 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { drop_debugger: env.VITE_DROP_DEBUGGER === 'true', drop_console: env.VITE_DROP_CONSOLE === 'true' } + }, + rollupOptions: { + plugins: env.NODE_ENV === 'production' ? [visualizer()] : undefined } }, server: { From 3a5db42c97f382f3fc701b8f113385b38a214583 Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Mon, 25 Dec 2023 15:16:08 +0800 Subject: [PATCH 12/19] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=9D=9E?= =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83=E6=89=93=E5=8C=85=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 3 +++ .env.gitee | 3 +++ .env.pro | 3 +++ .env.test | 3 +++ vite.config.ts | 4 ++-- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.env.dev b/.env.dev index afc3cee..3bec339 100644 --- a/.env.dev +++ b/.env.dev @@ -21,3 +21,6 @@ VITE_OUT_DIR=dist-dev # 标题 VITE_APP_TITLE=ElementAdmin + +# 是否包分析 +VITE_USE_BUNDLE_ANALYZER=false diff --git a/.env.gitee b/.env.gitee index 9ac2a52..37af85b 100644 --- a/.env.gitee +++ b/.env.gitee @@ -21,3 +21,6 @@ VITE_OUT_DIR=dist-pro # 标题 VITE_APP_TITLE=ElementAdmin + +# 是否包分析 +VITE_USE_BUNDLE_ANALYZER=false \ No newline at end of file diff --git a/.env.pro b/.env.pro index 432fc46..7bff03f 100644 --- a/.env.pro +++ b/.env.pro @@ -21,3 +21,6 @@ VITE_OUT_DIR=dist-pro # 标题 VITE_APP_TITLE=ElementAdmin + +# 是否包分析 +VITE_USE_BUNDLE_ANALYZER=true diff --git a/.env.test b/.env.test index b6eb7d9..4aa30ad 100644 --- a/.env.test +++ b/.env.test @@ -21,3 +21,6 @@ VITE_OUT_DIR=dist-test # 标题 VITE_APP_TITLE=ElementAdmin + +# 是否包分析 +VITE_USE_BUNDLE_ANALYZER=false diff --git a/vite.config.ts b/vite.config.ts index 618a31e..239ce1f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -111,7 +111,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { build: { minify: 'terser', outDir: env.VITE_OUT_DIR || 'dist', - sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false, + sourcemap: env.VITE_SOURCEMAP === 'true', // brotliSize: false, terserOptions: { compress: { @@ -120,7 +120,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { } }, rollupOptions: { - plugins: env.NODE_ENV === 'production' ? [visualizer()] : undefined + plugins: env.VITE_USE_BUNDLE_ANALYZER === 'true' ? [visualizer()] : undefined } }, server: { From 379b340750eb0d4f7816f5d7c25cbd2983fd33b9 Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Mon, 25 Dec 2023 16:27:55 +0800 Subject: [PATCH 13/19] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.base | 5 +++- .env.dev | 5 +++- .env.gitee | 7 ++++-- .env.pro | 5 +++- .env.test | 5 +++- src/App.vue | 9 +++++++ src/plugins/elementPlus/index.ts | 6 +++++ src/plugins/svgIcon/index.ts | 2 -- stylelint.config.js | 4 ---- vite.config.ts | 41 ++++++++++++++++++++------------ 10 files changed, 62 insertions(+), 27 deletions(-) diff --git a/.env.base b/.env.base index 7e2fb8f..7cf8898 100644 --- a/.env.base +++ b/.env.base @@ -1,5 +1,5 @@ # 环境 -NODE_ENV=development +VITE_NODE_ENV=development # 接口前缀 VITE_API_BASE_PATH= @@ -9,3 +9,6 @@ VITE_BASE_PATH=/ # 标题 VITE_APP_TITLE=ElementAdmin + +# 是否全量引入element-plus样式 +VITE_USE_ALL_ELEMENT_PLUS_STYLE=true diff --git a/.env.dev b/.env.dev index 3bec339..68a210d 100644 --- a/.env.dev +++ b/.env.dev @@ -1,5 +1,5 @@ # 环境 -NODE_ENV=production +VITE_NODE_ENV=production # 接口前缀 VITE_API_BASE_PATH= @@ -24,3 +24,6 @@ VITE_APP_TITLE=ElementAdmin # 是否包分析 VITE_USE_BUNDLE_ANALYZER=false + +# 是否全量引入element-plus样式 +VITE_USE_ALL_ELEMENT_PLUS_STYLE=false diff --git a/.env.gitee b/.env.gitee index 37af85b..95279ea 100644 --- a/.env.gitee +++ b/.env.gitee @@ -1,5 +1,5 @@ # 环境 -NODE_ENV=production +VITE_NODE_ENV=production # 接口前缀 VITE_API_BASE_PATH= @@ -23,4 +23,7 @@ VITE_OUT_DIR=dist-pro VITE_APP_TITLE=ElementAdmin # 是否包分析 -VITE_USE_BUNDLE_ANALYZER=false \ No newline at end of file +VITE_USE_BUNDLE_ANALYZER=false + +# 是否全量引入element-plus样式 +VITE_USE_ALL_ELEMENT_PLUS_STYLE=false \ No newline at end of file diff --git a/.env.pro b/.env.pro index 7bff03f..a489e81 100644 --- a/.env.pro +++ b/.env.pro @@ -1,5 +1,5 @@ # 环境 -NODE_ENV=production +VITE_NODE_ENV=production # 接口前缀 VITE_API_BASE_PATH= @@ -24,3 +24,6 @@ VITE_APP_TITLE=ElementAdmin # 是否包分析 VITE_USE_BUNDLE_ANALYZER=true + +# 是否全量引入element-plus样式 +VITE_USE_ALL_ELEMENT_PLUS_STYLE=false diff --git a/.env.test b/.env.test index 4aa30ad..b545901 100644 --- a/.env.test +++ b/.env.test @@ -1,5 +1,5 @@ # 环境 -NODE_ENV=production +VITE_NODE_ENV=production # 接口前缀 VITE_API_BASE_PATH= @@ -24,3 +24,6 @@ VITE_APP_TITLE=ElementAdmin # 是否包分析 VITE_USE_BUNDLE_ANALYZER=false + +# 是否全量引入element-plus样式 +VITE_USE_ALL_ELEMENT_PLUS_STYLE=false diff --git a/src/App.vue b/src/App.vue index 389960e..4a1c89d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,6 +4,7 @@ import { useAppStore } from '@/store/modules/app' import { ConfigGlobal } from '@/components/ConfigGlobal' import { useDesign } from '@/hooks/web/useDesign' import { useDark } from '@vueuse/core' +// import { ElNotification } from 'element-plus' const { getPrefixCls } = useDesign() @@ -21,6 +22,14 @@ const isDark = useDark({ }) isDark.value = appStore.getIsDark +// ElNotification({ +// title: '提示', +// type: 'warning', +// duration: 0, +// dangerouslyUseHTMLString: true, +// message: +// '

遇事不决,请先查阅常见问题,说不定你能找到相关解答

链接地址

' +// }) diff --git a/uno.config.ts b/uno.config.ts index 383e1c3..2eea413 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, toEscapedSelector as e, presetUno } from 'unocss' +import { defineConfig, toEscapedSelector as e, presetUno, presetIcons } from 'unocss' import transformerVariantGroup from '@unocss/transformer-variant-group' export default defineConfig({ @@ -111,6 +111,16 @@ ${selector}:after { } ] ], - presets: [presetUno({ dark: 'class', attributify: false })], - transformers: [transformerVariantGroup()] + presets: [ + presetUno({ dark: 'class', attributify: false }), + presetIcons({ + prefix: '' + }) + ], + transformers: [transformerVariantGroup()], + content: { + pipeline: { + include: [/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html|ts)($|\?)/] + } + } }) diff --git a/vite.config.ts b/vite.config.ts index 16c8541..9a46e50 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -126,7 +126,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { // 拆包 output: { manualChunks: { - vue: ['vue', 'vue-router', 'pinia', 'vue-i18n'], + 'vue-chunks': ['vue', 'vue-router', 'pinia', 'vue-i18n'], 'element-plus': ['element-plus'], 'wang-editor': ['@wangeditor/editor', '@wangeditor/editor-for-vue'], echarts: ['echarts', 'echarts-wordcloud'] From 16b93757d32c8ce2f611a62d6015072b0ecfc09a Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Tue, 26 Dec 2023 11:04:14 +0800 Subject: [PATCH 19/19] =?UTF-8?q?style:=20=E6=B7=BB=E5=8A=A0=E5=B8=B8?= =?UTF-8?q?=E8=A7=81=E9=97=AE=E9=A2=98=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 18 +++++++++--------- src/components/Icon/src/Icon.vue | 6 ++++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/App.vue b/src/App.vue index 4a1c89d..840ff90 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,7 +4,7 @@ import { useAppStore } from '@/store/modules/app' import { ConfigGlobal } from '@/components/ConfigGlobal' import { useDesign } from '@/hooks/web/useDesign' import { useDark } from '@vueuse/core' -// import { ElNotification } from 'element-plus' +import { ElNotification } from 'element-plus' const { getPrefixCls } = useDesign() @@ -22,14 +22,14 @@ const isDark = useDark({ }) isDark.value = appStore.getIsDark -// ElNotification({ -// title: '提示', -// type: 'warning', -// duration: 0, -// dangerouslyUseHTMLString: true, -// message: -// '

遇事不决,请先查阅常见问题,说不定你能找到相关解答

链接地址

' -// }) +ElNotification({ + title: '提示', + type: 'warning', + duration: 0, + dangerouslyUseHTMLString: true, + message: + '

遇事不决,请先查阅常见问题,说不定你能找到相关解答

链接地址

' +})