提交 93c13be8 编写于 作者: D DCloud_LXH

fix: tabBar.list 可能为空容错处理

上级 67e99828
......@@ -459,18 +459,16 @@ const DEFAULT_TAB_BAR: Partial<UniApp.TabBarOptions> = {
iconWidth: '24px',
spacing: '3px',
height: TABBAR_HEIGHT + 'px',
list: [],
}
function normalizeTabBar(
tabBar: UniApp.TabBarOptions,
platform: UniApp.PLATFORM
) {
const { list, midButton } = tabBar
if (!list || !list.length) {
return
}
const { midButton } = tabBar
tabBar = extend({}, DEFAULT_TAB_BAR, tabBar)
list.forEach((item) => {
tabBar.list.forEach((item) => {
if (item.iconPath) {
item.iconPath = normalizeFilepath(item.iconPath)
}
......
......@@ -56,7 +56,7 @@ function normalizeUniConfigThemeJsonIconPath(
) {
// 处理 tabbar 下 list -> item -> iconPath、selectedIconPath; midButton -> backgroundImage 路径 / 不开头的情况
const tabBar = pagesJson.tabBar
if (tabBar) {
if (tabBar && tabBar.list && tabBar.list.length) {
tabBar.list.forEach((item) => {
if (item.iconPath && item.iconPath.indexOf('@') === 0) {
parseThemeJsonIconPath(themeConfig, item.iconPath.replace(/^@/, ''))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册