"tabBar": {
"color": "black",
"selectedColor": "#4fd794",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/icon/home.png",
"selectedIconPath": "static/icon/home-active.png",
"text": "首页"
},{
"pagePath": "pages/home/index",
"iconPath": "static/icon/home.png",
"selectedIconPath": "static/icon/home-active.png",
"text": "分类"
},{
"pagePath": "pages/user/index",
"iconPath": "static/icon/home.png",
"selectedIconPath": "static/icon/home-active.png",
"text": "个人中心"
}]
},
![糖丶宝可梦](http://img-cdn-tc.dcloud.net.cn/uploads/avatar/001/60/84/64_avatar_mid.jpg?v=1648459578)
- 发布:2022-09-18 17:09
- 更新:2022-09-19 11:08
- 阅读:660
【报Bug】使用npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project创建项目tabbar添加list报错
产品分类: uniapp/H5
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: macOS Monterey 12.5.1
浏览器平台: Chrome
浏览器版本: 最新
项目创建方式: CLI
CLI版本号: vite:2.9.14
示例代码:
操作步骤:
tabbar里面添加list选项就报错,移除之后正常
tabbar里面添加list选项就报错,移除之后正常
预期结果:
正常显示底部tabbar
正常显示底部tabbar
实际结果:
运行成功报错,页面空白
运行成功报错,页面空白
bug描述:
【报Bug】使用npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project创建项目tabbar添加list报错
[Vue warn]: injection "Symbol(route location)" not found.
at <TabBar>
at <Layout>
at <App>
Uncaught TypeError: Cannot read properties of undefined (reading 'meta')
at uni-h5.es.js:19859:24
at callWithErrorHandling (vue.runtime.esm.js:1327:22)
at callWithAsyncErrorHandling (vue.runtime.esm.js:1336:21)
at ReactiveEffect.getter [as fn] (vue.runtime.esm.js:2959:24)
at ReactiveEffect.run (vue.runtime.esm.js:187:25)
at doWatch (vue.runtime.esm.js:3058:16)
at watchEffect (vue.runtime.esm.js:2879:12)
at useSwitchTab (uni-h5.es.js:19858:3)
at setup (uni-h5.es.js:19805:25)
at callWithErrorHandling (vue.runtime.esm.js:1327:22)
(匿名) @ uni-h5.es.js:19859
callWithErrorHandling @ vue.runtime.esm.js:1327
callWithAsyncErrorHandling @ vue.runtime.esm.js:1336
getter @ vue.runtime.esm.js:2959
run @ vue.runtime.esm.js:187
doWatch @ vue.runtime.esm.js:3058
watchEffect @ vue.runtime.esm.js:2879
useSwitchTab @ uni-h5.es.js:19858
setup @ uni-h5.es.js:19805
callWithErrorHandling @ vue.runtime.esm.js:1327
setupStatefulComponent @ vue.runtime.esm.js:8508
setupComponent @ vue.runtime.esm.js:8463
mountComponent @ vue.runtime.esm.js:6808
processComponent @ vue.runtime.esm.js:6783
patch @ vue.runtime.esm.js:6367
mountChildren @ vue.runtime.esm.js:6564
mountElement @ vue.runtime.esm.js:6472
processElement @ vue.runtime.esm.js:6444
patch @ vue.runtime.esm.js:6364
componentUpdateFn @ vue.runtime.esm.js:6922
run @ vue.runtime.esm.js:187
instance.update @ vue.runtime.esm.js:7034
setupRenderEffect @ vue.runtime.esm.js:7048
mountComponent @ vue.runtime.esm.js:6825
processComponent @ vue.runtime.esm.js:6783
patch @ vue.runtime.esm.js:6367
componentUpdateFn @ vue.runtime.esm.js:6922
run @ vue.runtime.esm.js:187
instance.update @ vue.runtime.esm.js:7034
setupRenderEffect @ vue.runtime.esm.js:7048
mountComponent @ vue.runtime.esm.js:6825
processComponent @ vue.runtime.esm.js:6783
patch @ vue.runtime.esm.js:6367
render @ vue.runtime.esm.js:7549
mount @ vue.runtime.esm.js:5729
app.mount @ vue.runtime.esm.js:10889
(匿名) @ main.ts:8
显示另外 7 个框架
3 个回复
糖丶宝可梦 (作者)
github上面有人提出的 issue 说添加两个以上即可,我添加完之后还是报这个错误
糖丶宝可梦 (作者)
在pages.json添加tabbar.list之后H5端会报Cannot read properties of undefined (reading 'meta')
去除tabbar下的list节点则正常
DCloud_UNI_GSQ
参考:https://github.com/dcloudio/uni-app/issues/3860
如果仍然有问题,提供一下测试工程