原来是“tarBar"错了,应该改为”tabBar"。[苦笑]
switchTap跳转失败点击跳转没反应,为什么呢? 新建一个小程序把代码和相关文件复制进去却可以跳转。 app.json: { "pages": [ "pages/welcome/welcome", "pages/post/post", "pages/movie/movie", "pages/post/post-comment/post-comment", "pages/post/post-detail/post-detail" ], "window": { "navigationBarBackgroundColor": "#4A6141" }, "tarBar":{ "borderStyle":"white", "selectedColor":"#4A6141", "color":"#333", "backgroundColor":"#fff", "position":"bottom", "list":[ { "pagePath":"pages/post/post", "text":"文字", "iconPath":"images/icon/wx_app_news.png", "selectedIconPath":"images/icon/wx_app_news@HL.png" }, { "pagePath":"pages/movie/movie", "text":"光影", "iconPath":"images/icon/wx_app_movie.png", "selectedIconPath":"images/icon/wx_app_movie@HL.png" } ] } } pages/welcome/welcome.js: onTapJump: function (event) { wx.switchTab({ url: '../post/post' }) }, <!--pages/welcome/welcome.wxml--> <view class="container"> <image class="avatar" src="../../images/avatar/avatar1.jpg"> </image> <text class="motto">Hello</text> <view catchtap='onTapJump' class="journey-container"> <text class="journey">开启小程序之旅</text> </view> </view>
2018-07-16