墨易
墨易
  • 发布:2020-06-28 10:12
  • 更新:2023-02-02 23:43
  • 阅读:8906

uniapp 删除 main.js 的 App.mpType = 'app' 后运行 H5 报错 Cannot read property 'meta' of undefined

分类:uni-app

前因

当前代码构建微信小程序可正常运行,但是无法运行H5,运行起来提示如下错误

chunk-vendors.js:4427 [Vue warn]: Property or method "keepAliveInclude" is not defined on the instance but referenced during render. Make sure that this property is   
chunk-vendors.js:4427 [Vue warn]: Error in render: "TypeError: Cannot read property 'meta' of undefined"

刚接触 uniapp,搜了一圈错误信息也没有找到问题所在,于是新建demo组个文件对比发现是 main.js 中我把 App.mpType = 'app' 删除了导致的。

后果

补齐main.js 的 App.mpType = 'app' 即可。
找到原因还是花费了一些时间,故记录一二,以便后者搜索错误提示就可以找到问题~

关于 App.mpType = 'app' 所能找到的说明

小程序页面组件和这个 App.vue 组件的写法和引入方式是一致的,为了区分两者,需要设置mpType值

1 关注 分享
大头1

要回复文章请先登录注册

n***@qq.com

n***@qq.com

谢谢
2023-02-02 23:43