uniapp项目启动报错:Uncaught TypeError: Cannot read property ‘meta‘ of undefined处理方案

简介: 刚入门uniapp,简单记录一下希望对有同样问题的小伙伴有所帮助,尽量少浪费时间.

  刚入门uniapp,简单记录一下希望对有同样问题的小伙伴有所帮助,尽量少浪费时间.

   新创建的uniapp项目,项目启动之后就报错,是不是很挫败,第一步就有问题!!!具体报错信息如下:

Uncaught TypeError: Cannot read property 'meta' of undefined

控制台截图:

44298408070e21e353bebcf903d1a3fd_8aa74c43fe5d435790c446fa6a0f3b45.png

   发现将pages.json中的tabbar节点全部注释掉之后启动正常,进一步来看将tabbar中的list属性注释掉之后项目启动也是正常的.到这里就是页面路径的问题.仔细观察发现项目pages下面的页面路径信息没有配置,导致tabbar中加载页面异常,按照页面加载顺序补充完整即可.项目启动是按照pages下面的页面的顺序进行加载,有文件但是配置中没有加载就会报错,tabbar的list属性中再去找对应的页面更会报错.正常的pages页面配置如下:

pages对象:

"pages": [ 
    {
      "path": "pages/index/index",
      "style": {
        "navigationBarTitleText": "uni-app"
      }
    },
    {
      "path": "pages/message/message",
      "style": {
        "navigationBarTitleText": "",
        "enablePullDownRefresh": false
      }
    }
  ]


页面截图:

c7ccdf8e16c03d0b408f58766a94ca31_11e5c9ece26a42d6a24ead9fa4033095.png

tabbar页面配置:

"tabBar": { //底部
    "color": "#999999",
    "selectedColor": "#09C160",
    "borderStyle": "black",
    "backgroundColor": "#ffffff",
    "list": [{
        "pagePath": "pages/index/index",
        "text": "首页"
      },
      {
        "pagePath": "pages/message/message",
        "text": "消息"
      }
    ]
  }


页面截图如下:

435a29eb0a06bdbd2a7fbc8a48cf8715_b5b77462eb5c431fa28d74a049b47e44.png


相关文章
|
3月前
|
存储 JavaScript 前端开发
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
|
3月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
85 0
|
3月前
|
JavaScript
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
72 0
|
5月前
|
前端开发 小程序 JavaScript
微信小程序-Unhandled promise rejection TypeError: Cannot read property ‘get‘ of undefined
微信小程序-Unhandled promise rejection TypeError: Cannot read property ‘get‘ of undefined
|
6月前
|
资源调度 前端开发
编译第三方前端项目时候出现Syntax Error: TypeError: Cannot set properties of undefined (setting ‘parent‘)
编译第三方前端项目时候出现Syntax Error: TypeError: Cannot set properties of undefined (setting ‘parent‘)
470 0
|
3月前
|
前端开发 JavaScript
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
61 0
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
Cannot read properties of undefined (reading ‘row‘)
Cannot read properties of undefined (reading ‘row‘)
Cannot read properties of undefined (reading ‘post‘)
Cannot read properties of undefined (reading ‘post‘)
|
4月前
|
JavaScript
element-ui Cannot read properties of undefined (reading ‘name‘),data中写成集合的形式
element-ui Cannot read properties of undefined (reading ‘name‘),data中写成集合的形式

热门文章

最新文章

下一篇
无影云桌面