feat: 整合unocss

Former-commit-id: 043192a1a31fe34e25c2f07ca62f148d6560eaa9
This commit is contained in:
haoxr
2023-02-26 23:56:28 +08:00
parent 8f3315ebe2
commit 1190ce349c
2 changed files with 8 additions and 1 deletions

View File

@@ -15,6 +15,8 @@ import '@/styles/index.scss';
import 'element-plus/theme-chalk/index.css'; import 'element-plus/theme-chalk/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css'; import 'element-plus/theme-chalk/dark/css-vars.css';
import 'uno.css';
const app = createApp(App); const app = createApp(App);
// 自定义指令 // 自定义指令
import * as directive from '@/directive'; import * as directive from '@/directive';

View File

@@ -11,6 +11,8 @@ import IconsResolver from 'unplugin-icons/resolver';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'; import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import UnoCSS from 'unocss/vite';
import path from 'path'; import path from 'path';
const pathSrc = path.resolve(__dirname, 'src'); const pathSrc = path.resolve(__dirname, 'src');
@@ -30,7 +32,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
scss: { scss: {
javascriptEnabled: true, javascriptEnabled: true,
additionalData: ` additionalData: `
@use "@/styles/variables.module.scss" as *; @use "@/styles/variables.scss" as *;
` `
} }
} }
@@ -54,6 +56,9 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
}, },
plugins: [ plugins: [
vue(), vue(),
UnoCSS({
/* options */
}),
AutoImport({ AutoImport({
// 自动导入 Vue 相关函数ref, reactive, toRef 等 // 自动导入 Vue 相关函数ref, reactive, toRef 等
imports: ['vue', '@vueuse/core'], imports: ['vue', '@vueuse/core'],