From 4249465b7c328fb744a485a0741da26f7c5f6af6 Mon Sep 17 00:00:00 2001 From: xingyu Date: Sat, 29 Jul 2023 14:40:55 +0800 Subject: [PATCH] wip: use unocss --- 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 | 118 +++++++++--------- 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, 294 insertions(+), 250 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 d5b6a4ac..02067107 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' @@ -15,6 +14,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() @@ -27,7 +27,7 @@ export function createVitePlugins() { return [ Vue(), VueJsx(), - WindiCSS(), + UnoCSS(), progress(), PurgeIcons(), ElementPlus({}), diff --git a/package.json b/package.json index a2a60d54..e6be32f8 100644 --- a/package.json +++ b/package.json @@ -87,9 +87,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", @@ -114,6 +116,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", @@ -125,9 +128,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 298202b1..1446d9a7 100644 --- a/src/components/ContentDetailWrap/src/ContentDetailWrap.vue +++ b/src/components/ContentDetailWrap/src/ContentDetailWrap.vue @@ -28,7 +28,7 @@ onMounted(() => {
diff --git a/src/components/Descriptions/src/Descriptions.vue b/src/components/Descriptions/src/Descriptions.vue index 0baa396c..06e1096a 100644 --- a/src/components/Descriptions/src/Descriptions.vue +++ b/src/components/Descriptions/src/Descriptions.vue @@ -71,14 +71,14 @@ const toggleClick = () => {
diff --git a/src/components/Dialog/src/Dialog.vue b/src/components/Dialog/src/Dialog.vue index c1114d36..5fd298bb 100644 --- a/src/components/Dialog/src/Dialog.vue +++ b/src/components/Dialog/src/Dialog.vue @@ -99,13 +99,19 @@ const dialogStyle = computed(() => { diff --git a/src/components/Editor/src/Editor.vue b/src/components/Editor/src/Editor.vue index 3b2013d1..d972552d 100644 --- a/src/components/Editor/src/Editor.vue +++ b/src/components/Editor/src/Editor.vue @@ -164,7 +164,6 @@ const handleChange = (editor: IDomEditor) => { // 组件销毁时,及时销毁编辑器 onBeforeUnmount(() => { const editor = unref(editorRef.value) - if (editor === null) return // 销毁,并移除 editor editor?.destroy() @@ -181,12 +180,12 @@ defineExpose({