天天看點

switchTab before pages are registered

在開發微信從小程式的時候遇到了switchTab before pages are registered的報錯,它的意思是在switchtab之前有頁面注冊,去開發文檔了解到:

 wx.switchTab(OBJECT) 功能

 跳轉到 tabBar 頁面,并關閉其他所有非 tabBar 頁面

轉到app.json發現了問題。

pages中的前幾個頁面路徑必須和tabBar中list的頁面順序相同,如下所示:

"pages":[ "pages/index/index", "pages/log/log" ] "tabBar": { "list": [ { "pagePath": "pages/index/index", "text": "首頁" }, { "pagePath": "pages/log/log",

"text": "資料"

}

繼續閱讀