提交 1c97be13 编写于 作者: d-u-a's avatar d-u-a

feat: app tabbar API 支持 iconfont 属性

上级 0694f967
......@@ -47,10 +47,17 @@ export const setTabBarBadge = defineAsyncApi<API_TYPE_SET_TAB_BAR_BADGE>(
export const setTabBarItem = defineAsyncApi<API_TYPE_SET_TAB_BAR_ITEM>(
API_SET_TAB_BAR_ITEM,
(
{ index, text, iconPath, selectedIconPath, pagePath, visible },
{ index, text, iconPath, selectedIconPath, pagePath, visible, iconfont },
{ resolve, reject }
) => {
tabBar.setTabBarItem(index, text, iconPath, selectedIconPath, visible)
tabBar.setTabBarItem(
index,
text,
iconPath,
selectedIconPath,
visible,
iconfont
)
const route = pagePath && __uniRoutes.find(({ path }) => path === pagePath)
if (route) {
const meta = route.meta
......
......@@ -58,9 +58,13 @@ function setTabBarItem(
text?: string,
iconPath?: string,
selectedIconPath?: string,
visible?: boolean
visible?: boolean,
iconfont?: UniApp.SetTabBarItemIconFontOptions
) {
type TabBarItem = Record<string, string | number | boolean | undefined>
type TabBarItem = Record<
string,
string | number | boolean | undefined | UniApp.SetTabBarItemIconFontOptions
>
const item: TabBarItem = {
index,
}
......@@ -73,6 +77,9 @@ function setTabBarItem(
if (selectedIconPath) {
item.selectedIconPath = getRealPath(selectedIconPath)
}
if (iconfont !== undefined) {
item.iconfont = iconfont
}
if (visible !== undefined) {
item.visible = config.list[index].visible = visible
delete item.index
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册