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: 30rpx; margin-left: 24rpx; font-size:32rpx; font-weight:600; color:rgba(51,51,51,1); line-height:45rpx; display: block}.box{ margin-top: 20rpx; background-color: #fff; padding-top: 30rpx; padding-bottom: 30rpx; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center}.location-box{ width:200rpx; height:80rpx; border-radius:2rpx; border:2rpx solid rgba(185, 185, 185, 1); display: flex; justify-content: center; align-items: center; margin-left: 30rpx; margin-bottom: 30rpx;}.location-name{ font-size:28rpx; color:rgba(51, 51, 51, 1); line-height:40rpx;} |
在开发者工具中,模拟机点击跳转什么的都能实现,没问题。我把bindtap换到其它层级,结果也一样。其它页面也有用到bindtap来跳转,其他的页面明明没有问题呀?到底问题出在哪里呢?请大佬帮忙解答!
也排除了以下几种情况
css中使用了position,或者设置了z-index
js中页面路径出错
