From 2b3715f1610b4176d7abe33e34542389cef61853 Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期六, 12 四月 2025 17:12:22 +0800 Subject: [PATCH] Merge branch 'main' of http://lanpucloud.cn:1111/r/eims-master --- eims-ui-mobile/uno.config.ts | 89 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 89 insertions(+), 0 deletions(-) diff --git a/eims-ui-mobile/uno.config.ts b/eims-ui-mobile/uno.config.ts new file mode 100644 index 0000000..1c15aad --- /dev/null +++ b/eims-ui-mobile/uno.config.ts @@ -0,0 +1,89 @@ +// uno.config.ts +import { + type Preset, + defineConfig, + presetUno, + presetAttributify, + presetIcons, + transformerDirectives, + transformerVariantGroup, +} from 'unocss' + +import { presetApplet, presetRemRpx, transformerAttributify } from 'unocss-applet' + +// @see https://unocss.dev/presets/legacy-compat +// import { presetLegacyCompat } from '@unocss/preset-legacy-compat' + +const isMp = process.env?.UNI_PLATFORM?.startsWith('mp') ?? false + +const presets: Preset[] = [] +if (isMp) { + // 浣跨敤灏忕▼搴忛璁� + presets.push(presetApplet(), presetRemRpx()) +} else { + presets.push( + // 闈炲皬绋嬪簭鐢ㄥ畼鏂归璁� + presetUno(), + // 鏀寔css class灞炴�у寲 + presetAttributify(), + ) +} +export default defineConfig({ + presets: [ + ...presets, + // 鏀寔鍥炬爣锛岄渶瑕佹惌閰嶅浘鏍囧簱锛宔g: @iconify-json/carbon, 浣跨敤 `<button class="i-carbon-sun dark:i-carbon-moon" />` + presetIcons({ + scale: 1.2, + warn: true, + extraProperties: { + display: 'inline-block', + 'vertical-align': 'middle', + }, + }), + // 灏嗛鑹插嚱鏁� (rgb()鍜宧sl()) 浠庣┖鏍煎垎闅旇浆鎹负閫楀彿鍒嗛殧锛屾洿濂界殑鍏煎鎬pp绔紝example锛� + // `rgb(255 0 0)` -> `rgb(255, 0, 0)` + // `rgba(255 0 0 / 0.5)` -> `rgba(255, 0, 0, 0.5)` + // 涓庣兢鍙嬬殑姝e父鍐欐硶鍐茬獊锛屽厛鍘绘帀锛侊紙2024-05-25锛� + // presetLegacyCompat({ + // commaStyleColorFunction: true, + // }) as Preset, + ], + /** + * 鑷畾涔夊揩鎹疯鍙� + * @see https://github.com/unocss/unocss#shortcuts + */ + shortcuts: [['center', 'flex justify-center items-center']], + transformers: [ + // 鍚敤 @apply 鍔熻兘 + transformerDirectives(), + // 鍚敤 () 鍒嗙粍鍔熻兘 + // 鏀寔css class缁勫悎锛宔g: `<div class="hover:(bg-gray-400 font-medium) font-(light mono)">娴嬭瘯 unocss</div>` + transformerVariantGroup(), + // Don't change the following order + transformerAttributify({ + // 瑙e喅涓庣涓夋柟妗嗘灦鏍峰紡鍐茬獊闂 + prefixedOnly: true, + prefix: 'fg', + }), + ], + 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)' }], + ], +}) + +/** + * 鏈�缁堣繖涓�濂楃粍鍚堜笅鏉ヤ細寰楀埌锛� + * mp 閲岄潰锛歮t-4 => margin-top: 32rpx == 16px + * h5 閲岄潰锛歮t-4 => margin-top: 1rem == 16px + * + * 濡傛灉鏄紶缁熸柟寮忓啓鏍峰紡锛屽垯鎺ㄨ崘璁捐绋胯缃负 750锛岃繖鏍疯璁$1px锛屼唬鐮佸啓1rpx銆� + * rpx鏄搷搴斿紡鐨勶紝鍙互璁╀笉鍚岃澶囩殑灞忓箷鏄剧ず鏁堟灉淇濇寔涓�鑷淬�� + */ -- Gitblit v1.9.3