bindtap绑定事件在模拟机上可以生效,真机上没反应?
< view class = "box" > < view bindtap = "changeLocation" wx:for = "{{locations}}" wx:key = "{{locations.name}}" class = "location-box" > < text class = "location-name" >{{item.name}}</ text > </ view > </ view > |
data: { current: "广州站" , locations: [{ name: "成都站" }, { name: "武汉站" }, { name: "济南站" }, { name: "北京站" }, { name: "上海站" }], }, changeLocation(e) { // console.log(e); this .setData({ current: e._relatedInfo.anchorTargetText, }); wx.switchTab({ url: "/pages/home/home" , }); }, |
.title{ margin-top : 30 rpx; margin-left : 24 rpx; font-size : 32 rpx; font-weight : 600 ; color :rgba( 51 , 51 , 51 , 1 ); line-height : 45 rpx; display : block } .box{ margin-top : 20 rpx; background-color : #fff ; padding-top : 30 rpx; padding-bottom : 30 rpx; display : flex; flex- direction : row; flex-wrap: wrap; align-items: center } .location-box{ width : 200 rpx; height : 80 rpx; border-radius: 2 rpx; border : 2 rpx solid rgba( 185 , 185 , 185 , 1 ); display : flex; justify- content : center ; align-items: center ; margin-left : 30 rpx; margin-bottom : 30 rpx; } .location-name{ font-size : 28 rpx; color :rgba( 51 , 51 , 51 , 1 ); line-height : 40 rpx; } |
在开发者工具中,模拟机点击跳转什么的都能实现,没问题。我把bindtap换到其它层级,结果也一样。其它页面也有用到bindtap来跳转,其他的页面明明没有问题呀?到底问题出在哪里呢?请大佬帮忙解答!
也排除了以下几种情况
css中使用了position,或者设置了z-index
js中页面路径出错