From b48ef5eb29cc199089b13ec62115e8429ef5fdb7 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Mon, 26 May 2025 23:17:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(unocss):=20=E6=B7=BB=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=B1=BB=E5=9E=8B=E5=A3=B0=E6=98=8E=E5=B9=B6=E6=89=A9?= =?UTF-8?q?=E5=B1=95unocss=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加fg-navbar组件类型声明文件 扩展unocss配置,新增安全区域间距规则、主题色配置及常用快捷类 --- src/types/components.d.ts | 12 ++++++++++++ uno.config.ts | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/types/components.d.ts diff --git a/src/types/components.d.ts b/src/types/components.d.ts new file mode 100644 index 0000000..b23ba0d --- /dev/null +++ b/src/types/components.d.ts @@ -0,0 +1,12 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by vite-plugin-uni-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +declare module 'vue' { + export interface GlobalComponents { + FgNavbar: typeof import('./../components/fg-navbar/fg-navbar.vue')['default'] + } +} diff --git a/uno.config.ts b/uno.config.ts index 58f8cb3..6a98766 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -13,5 +13,38 @@ export default defineConfig({ }, }), ], - transformers: [transformerDirectives(), transformerVariantGroup()], + transformers: [ + // 启用指令功能:主要用于支持 @apply、@screen 和 theme() 等 CSS 指令 + transformerDirectives(), + // 启用 () 分组功能 + // 支持css class组合,eg: `
测试 unocss
` + transformerVariantGroup(), + ], + shortcuts: [ + { + center: 'flex justify-center items-center', + }, + ], + rules: [ + [ + 'p-safe', + { + padding: + 'env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)', + }, + ], + ['pt-safe', { 'padding-top': 'env(safe-area-inset-top)' }], + ['pb-safe', { 'padding-bottom': 'env(safe-area-inset-bottom)' }], + ], + theme: { + colors: { + /** 主题色,用法如: text-primary */ + primary: 'var(--wot-color-theme,#0957DE)', + }, + fontSize: { + /** 提供更小号的字体,用法如:text-2xs */ + '2xs': ['20rpx', '28rpx'], + '3xs': ['18rpx', '26rpx'], + }, + }, })