From d3e0b17b196eca6d6e9d33c39558f1905cd167f0 Mon Sep 17 00:00:00 2001
From: feige996 <1020102647@qq.com>
Date: Mon, 4 Aug 2025 14:30:41 +0800
Subject: [PATCH] =?UTF-8?q?feat(tabbar):=20=E6=B7=BB=E5=8A=A0=20uniUi=20?=
=?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=B1=BB=E5=9E=8B=E6=94=AF=E6=8C=81=E5=B9=B6?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A6=96=E9=A1=B5=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
更新 tabbar 配置,新增 uniUi 图标类型选项并修改首页默认使用 uniUi 图标
移除旧的 uiLib 配置示例,添加详细注释说明各图标类型的使用方式
---
src/tabbar/config.ts | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/tabbar/config.ts b/src/tabbar/config.ts
index 556b7bd..e243fa3 100644
--- a/src/tabbar/config.ts
+++ b/src/tabbar/config.ts
@@ -2,7 +2,7 @@ import type { TabBar } from '@uni-helper/vite-plugin-uni-pages'
type FgTabBarItem = TabBar['list'][0] & {
icon: string
- iconType: 'uiLib' | 'unocss' | 'iconfont' | 'local'
+ iconType: 'uniUi' | 'uiLib' | 'unocss' | 'iconfont' | 'local'
}
/**
@@ -34,11 +34,25 @@ export const tabbarList: FgTabBarItem[] = [
selectedIconPath: 'static/tabbar/homeHL.png',
pagePath: 'pages/index/index',
text: '首页',
- // 选用 UI 框架自带的 icon 时,iconType 为 uiLib
- // 需要自行替换vue代码中的图标代码
- iconType: 'uiLib',
+ // 本框架内置了 uniapp 官方UI库 (uni-ui)的图标库
+ // 使用方式如:
+ // 图标列表地址:https://uniapp.dcloud.net.cn/component/uniui/uni-icons.html
+ iconType: 'uniUi',
icon: 'home',
},
+ // {
+ // iconPath: 'static/tabbar/home.png',
+ // selectedIconPath: 'static/tabbar/homeHL.png',
+ // pagePath: 'pages/index/index',
+ // text: '首页',
+ // // 选用 UI 框架自带的 icon 时,iconType 为 uiLib
+ // // 需要自行替换vue代码中的图标代码,需要查看相关UI库的图标代码
+ // // 如: (https://wot-design-uni.cn/component/icon.html)
+ // // 如: (https://www.uvui.cn/components/icon.html)
+ // // 如: (https://sard.wzt.zone/sard-uniapp-docs/components/icon)(sar没有home图标^_^)
+ // iconType: 'uiLib',
+ // icon: 'home',
+ // },
{
iconPath: 'static/tabbar/example.png',
selectedIconPath: 'static/tabbar/exampleHL.png',