page.json 如下
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
},
{
"path": "pages/about/about",
"style": {
"navigationBarTitleText": "about",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#333333",
"selectedColor": "#330",
"backgroundColor": "#F8F8F8",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页"
},
{
"pagePath": "pages/about/about",
"text": "关于"
}
]
}
}

- 发布:2025-07-10 10:45
- 更新:2025-07-10 11:57
- 阅读:38
产品分类: uniapp/H5
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows11
浏览器平台: Edge
浏览器版本: 138.0.3351.65
项目创建方式: CLI
CLI版本号: 11.1.0
示例代码:
操作步骤:
下载 uni-preset-vue-vite 模板并用 pnpm 安装依赖,新增 about 页面,配置 page.json,运行 pnpm run dev:h5
下载 uni-preset-vue-vite 模板并用 pnpm 安装依赖,新增 about 页面,配置 page.json,运行 pnpm run dev:h5
预期结果:
浏览器不报错,页面能正常渲染
浏览器不报错,页面能正常渲染
实际结果:
浏览器报错:TypeError: Cannot assign to read only property '_' of object '#<Object>',页面无法渲染
浏览器报错:TypeError: Cannot assign to read only property '_' of object '#<Object>',页面无法渲染
bug描述:
使用 pnpm(版本 10.5.2) 为 uni-preset-vue-vite 安装依赖后,配置 tabBar 后 web 页面无法渲染,浏览器报错如下:
TypeError: Cannot assign to read only property '_' of object '#<Object>'
at assign (<anonymous>)
at updateSlots (vue.runtime.esm.js:5848:9)
at updateComponentPreRender (vue.runtime.esm.js:7518:5)
at ReactiveEffect.componentUpdateFn [as fn] (vue.runtime.esm.js:7433:11)
at ReactiveEffect.run (vue.runtime.esm.js:180:19)
at instance.update (vue.runtime.esm.js:7500:16)
at updateComponent (vue.runtime.esm.js:7308:18)
at processComponent (vue.runtime.esm.js:7242:7)
at patch (vue.runtime.esm.js:6699:11)
at patchKeyedChildren (vue.runtime.esm.js:7653:9)

2***@qq.com (作者)
可能是仓储的问题,之前用 https://registry.npmmirror.com/ 的资源产生上面报错,现在换成 npm 官方的 https://registry.npmjs.org/ 后就没问题了
2***@qq.com (作者)
已上传压缩包
2025-07-10 11:32