From 4f81427aa02ff06022ae931cf878175045704444 Mon Sep 17 00:00:00 2001 From: xingyu Date: Sat, 29 Jul 2023 14:40:55 +0800 Subject: [PATCH] wip: use unocss (cherry picked from commit 4249465b7c328fb744a485a0741da26f7c5f6af6) --- build/vite/index.ts | 4 +- package.json | 7 +- .../src/ContentDetailWrap.vue | 2 +- .../Descriptions/src/Descriptions.vue | 4 +- src/components/Dialog/src/Dialog.vue | 28 ++--- src/components/Editor/src/Editor.vue | 5 +- src/layout/components/AppView.vue | 25 ++-- .../LocaleDropdown/src/LocaleDropdown.vue | 2 +- src/layout/components/Logo/src/Logo.vue | 3 +- src/layout/components/Menu/src/Menu.vue | 9 -- src/layout/components/Setting/src/Setting.vue | 1 - src/layout/components/TabMenu/src/TabMenu.vue | 15 +-- .../components/TagsView/src/TagsView.vue | 112 +++++++++--------- src/layout/components/ToolHeader.vue | 14 +-- .../components/UserInfo/src/UserInfo.vue | 2 +- src/layout/components/useRenderLayout.tsx | 80 +++++++++---- src/main.ts | 2 +- src/plugins/unocss/index.ts | 1 + src/plugins/windi.css/index.ts | 3 - src/styles/var.css | 17 +-- src/views/Home/Index.vue | 4 +- src/views/Login/Login.vue | 28 +++-- tsconfig.json | 4 +- uno.config.ts | 105 ++++++++++++++++ windi.config.ts | 61 ---------- 25 files changed, 291 insertions(+), 247 deletions(-) create mode 100644 src/plugins/unocss/index.ts delete mode 100644 src/plugins/windi.css/index.ts create mode 100644 uno.config.ts delete mode 100644 windi.config.ts diff --git a/build/vite/index.ts b/build/vite/index.ts index 7b4a17bd..bdda98d0 100644 --- a/build/vite/index.ts +++ b/build/vite/index.ts @@ -1,7 +1,6 @@ import { resolve } from 'path' import Vue from '@vitejs/plugin-vue' import VueJsx from '@vitejs/plugin-vue-jsx' -import WindiCSS from 'vite-plugin-windicss' import progress from 'vite-plugin-progress' import EslintPlugin from 'vite-plugin-eslint' import PurgeIcons from 'vite-plugin-purge-icons' @@ -14,6 +13,7 @@ import viteCompression from 'vite-plugin-compression' import topLevelAwait from 'vite-plugin-top-level-await' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' +import UnoCSS from 'unocss/vite' export function createVitePlugins() { const root = process.cwd() @@ -24,7 +24,7 @@ export function createVitePlugins() { return [ Vue(), VueJsx(), - WindiCSS(), + UnoCSS(), progress(), PurgeIcons(), ElementPlus({}), diff --git a/package.json b/package.json index ea1cd216..68f7702e 100644 --- a/package.json +++ b/package.json @@ -89,9 +89,11 @@ "@types/qs": "^6.9.7", "@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/parser": "^6.2.0", + "@unocss/transformer-variant-group": "^0.51.4", "@vitejs/plugin-legacy": "^4.1.1", "@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue-jsx": "^3.0.1", + "@vue-macros/volar": "^0.12.3", "autoprefixer": "^10.4.14", "bpmn-js": "^8.9.0", "bpmn-js-properties-panel": "^0.46.0", @@ -116,6 +118,7 @@ "stylelint-order": "^6.0.3", "terser": "^5.19.2", "typescript": "5.1.6", + "unocss": "^0.54.0", "unplugin-auto-import": "^0.16.6", "unplugin-element-plus": "^0.7.2", "unplugin-vue-components": "^0.25.1", @@ -127,9 +130,7 @@ "vite-plugin-purge-icons": "^0.9.2", "vite-plugin-svg-icons": "^2.0.1", "vite-plugin-top-level-await": "^1.3.1", - "vite-plugin-windicss": "^1.9.0", - "vue-tsc": "^1.8.8", - "windicss": "^3.5.6" + "vue-tsc": "^1.8.8" }, "license": "MIT", "repository": { diff --git a/src/components/ContentDetailWrap/src/ContentDetailWrap.vue b/src/components/ContentDetailWrap/src/ContentDetailWrap.vue index 9469a552..2867f5ed 100644 --- a/src/components/ContentDetailWrap/src/ContentDetailWrap.vue +++ b/src/components/ContentDetailWrap/src/ContentDetailWrap.vue @@ -26,7 +26,7 @@ onMounted(() => {
diff --git a/src/components/Descriptions/src/Descriptions.vue b/src/components/Descriptions/src/Descriptions.vue index 6b1ffbd1..32c97d5c 100644 --- a/src/components/Descriptions/src/Descriptions.vue +++ b/src/components/Descriptions/src/Descriptions.vue @@ -69,14 +69,14 @@ const toggleClick = () => {
diff --git a/src/components/Dialog/src/Dialog.vue b/src/components/Dialog/src/Dialog.vue index 28deba46..acb2b994 100644 --- a/src/components/Dialog/src/Dialog.vue +++ b/src/components/Dialog/src/Dialog.vue @@ -96,13 +96,19 @@ const dialogStyle = computed(() => { diff --git a/src/components/Editor/src/Editor.vue b/src/components/Editor/src/Editor.vue index 73925f86..a76dfdcf 100644 --- a/src/components/Editor/src/Editor.vue +++ b/src/components/Editor/src/Editor.vue @@ -162,7 +162,6 @@ const handleChange = (editor: IDomEditor) => { // 组件销毁时,及时销毁编辑器 onBeforeUnmount(() => { const editor = unref(editorRef.value) - if (editor === null) return // 销毁,并移除 editor editor?.destroy() @@ -179,12 +178,12 @@ defineExpose({