Ai
3 Star 10 Fork 5

江阳小道/uniapp-vue3-template

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
uno.config.ts 2.06 KB
一键复制 编辑 原始数据 按行查看 历史
oyjt 提交于 2025-08-15 18:28 +08:00 . refactor: 主题设置功能重构
import {
defineConfig,
presetIcons,
transformerDirectives,
transformerVariantGroup,
} from 'unocss';
import { presetWeapp } from 'unocss-preset-weapp';
import { extractorAttributify, transformerClass } from 'unocss-preset-weapp/transformer';
const { presetWeappAttributify, transformerAttributify } = extractorAttributify();
export default defineConfig({
presets: [
// https://github.com/MellowCo/unocss-preset-weapp
presetWeapp(),
// attributify autocomplete
presetWeappAttributify() as any,
// https://unocss.dev/presets/icons
presetIcons({
scale: 1.2,
warn: true,
extraProperties: {
'display': 'inline-block',
'vertical-align': 'middle',
},
}),
],
/**
* 自定义快捷语句
* @see https://github.com/unocss/unocss#shortcuts
*/
shortcuts: {
'border-base': 'border border-gray-500_10',
'center': 'flex justify-center items-center',
},
theme: {
colors: {
// 主题颜色
'primary': 'var(--theme-primary)',
'success': 'var(--theme-success)',
'warning': 'var(--theme-warning)',
'error': 'var(--theme-error)',
// 文字颜色
'text-main': 'var(--theme-main-color)',
'text-content': 'var(--theme-content-color)',
'text-tips': 'var(--theme-tips-color)',
'text-light': 'var(--theme-light-color)',
'text-disabled': 'var(--theme-disabled-color)',
// 背景颜色
'bg-main': 'var(--theme-bg-color)',
'bg-secondary': 'var(--theme-bg-color-secondary)',
// 边框颜色
'border-main': 'var(--theme-border-color)',
},
},
transformers: [
// 启用 @apply 功能
transformerDirectives({
enforce: 'pre',
}),
// https://unocss.dev/transformers/variant-group
// 启用 () 分组功能
transformerVariantGroup(),
// https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerAttributify
transformerAttributify() as any,
// https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerClass
transformerClass(),
],
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/ouyang/uniapp-vue3-template.git
git@gitee.com:ouyang/uniapp-vue3-template.git
ouyang
uniapp-vue3-template
uniapp-vue3-template
main

搜索帮助