wx.navigateTo执行不跳转新页面也不报错
把没有效果的代码里面的链接换成可以执行的链接,点击之后正常打开,换成不存在的目录,正常报错,就是现在这个样子,啥反应都没有
手机测试日志里面也有调用事件,就是没反应
JS代码
Page({ //这段代码点击没有效果 clickC: function () { wx.navigateTo({ url: '../nopage/nopage' , }) }, //下面的代码可以正常执行 clickPromise: function () { wx.navigateTo({ url: '../poster/promise/promise' , }) }, clickProcess: function () { wx.navigateTo({ url: '../poster/process/process' , }) }, clickNotice: function () { wx.navigateTo({ url: '../poster/notice/notice' , }) }, clickQuestion: function () { wx.navigateTo({ url: '../poster/question/question' , }) }, }) |
wxml代码
< view class = 'view-price-bg' bindtap = 'clickC' wx:for = "{{priceView}}" wx:key = "key" > < image class = 'image-title' src = '{{item.image}}' bindtap = 'clickC' >C1</ image > < text class = 'text-price' bindtap = 'clickC' >{{item.price}}元</ text > < text class = 'text-title' bindtap = 'clickC' >{{item.name}}</ text > < view class = 'view-text-content' bindtap = 'clickC' > < rich-text class = 'text-content' bindtap = 'clickC' >{{item.descriptionL1}}</ rich-text > < rich-text class = 'text-content' bindtap = 'clickC' >{{item.descriptionL2}}</ rich-text > </ view > < view class = 'view-icon-right' bindtap = 'clickC' > < text class = 'text-icon-right' bindtap = 'clickC' >〉</ text > </ view > </ view > < view class = 'view-button-bg' > < view > < view class = 'view-button' bindtap = 'clickPromise' > < image class = 'image-button' src = '../../images/icon-promise.png' ></ image > < text class = 'text-button' >服务承诺</ text > </ view > < view class = 'view-button' bindtap = 'clickProcess' > < image class = 'image-button' src = '../../images/icon-process.png' ></ image > < text class = 'text-button' >学车流程</ text > </ view > < view class = 'view-button' bindtap = 'clickNotice' > < image class = 'image-button' src = '../../images/icon-notice.png' ></ image > < text class = 'text-button' >报名须知</ text > </ view > < view class = 'view-button' bindtap = "clickQuestion" > < image class = 'image-button' src = '../../images/icon-question.png' ></ image > < text class = 'text-button' >常见问题</ text > </ view > </ view > </ view > |
文件目录
页面效果
真机测试
2 回复
我的问题找到了,不是代码的问题,而是navigateTo不能跳转到tabBar的页面,你检查一下是不是这个问题;
另外现在页面跳转推荐使用<navigator>组件,可以试试,效果更好更简单
< navigator url = "/page/navigate/navigate?title=navigate" hover-class = "navigator-hover" >跳转到新页面</ navigator > |
文档地址:https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html