From d386967176e306f97ce8a6c703b7f151259521fc Mon Sep 17 00:00:00 2001 From: xujiujiu <906784584@qq.com> Date: Fri, 2 Aug 2024 11:09:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20[taro-mini-runner]=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8Ftabbar=20list=20=E4=B8=AD=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=B1=BB=E5=9E=8B=E4=B8=8D=E5=8C=B9=E9=85=8D=E6=97=B6?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=97=B6=E9=9C=80=E6=8A=A5=E9=94=99=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../taro-webpack5-runner/src/plugins/MiniPlugin.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts b/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts index c2d38b89dc04..32f912dea62c 100644 --- a/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts +++ b/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts @@ -1048,7 +1048,16 @@ export default class TaroMiniPlugin { if (tabBar && typeof tabBar === 'object' && !isEmptyObject(tabBar)) { // eslint-disable-next-line dot-notation const list = tabBar['list'] || [] - list.forEach(item => { + list.forEach((item, index) => { + if (Object.prototype.toString.call(item) !== '[object Object]') { + throw new Error(`[ app.json 文件内容错误] app.json: tabBar.list[${index}] 字段需为 object`) + } + if (!Object.prototype.hasOwnProperty.call(item, 'pagePath') || item.pagePath === '') { + throw new Error(`[ app.json 文件内容错误] app.json: tabBar.list[${index}].pagePath 不能为空`) + } + if (typeof item.pagePath !== 'string') { + throw new Error(`[ app.json 文件内容错误] app.json: tabBar.list[${index}].pagePath 需为 string`) + } // eslint-disable-next-line dot-notation item['iconPath'] && this.tabBarIcons.add(item['iconPath']) // eslint-disable-next-line dot-notation