小程序传参问题
发布于 6 年前 作者 zhangping 2513 次浏览 来自 问答

<scroll-view scroll-y style=“height: 700rpx;”>

<block wx:for="{{listData}}" wx:key="{{index}}">

<view class=“tr bg-g” wx:if="{{index % 2 == 0}}" data-my-args=“111” bindtap=‘enterDetail’ >

<view class=“td”>{{item.FlightDate}}</view>

<view class=“td”>{{item.Dep_Airport_CN}}</view>

<view class=“td”>{{item.New_ATD}}</view>

<view class=“td”>{{item.New_ATA}}</view>

<view class=“td”>{{item.Arr_Airport_CN}}</view>

</view>

<view class=“tr” wx:else data-my-args=“222” bindtap=‘enterDetail’>

<view class=“td”>{{item.FlightDate}}</view>

<view class=“td”>{{item.Dep_Airport_CN}}</view>

<view class=“td”>{{item.New_ATD}}</view>

<view class=“td”>{{item.New_ATA}}</view>

<view class=“td”>{{item.Arr_Airport_CN}}</view>

</view>

</block>

</scroll-view>

-----

enterDetail:function(e){

console.log(e.target.dataset.myArgs);

// wx.navigateTo({

//   url: ‘…/hbdt/hbdtdetail/hbdtdetail’

// })

}

以上代码在页面上可以正常显示数据了,但是在实现enterDetail方法时,点击tr,有时能获取myArgs的值,有时却获取不到,是undefined.请问这个问题该怎么处理呢?

另外我的手机在titlebar上的返回键是X状态,不是《返回 状态。苹果手机就正常

回到顶部