当使用wx.for显示列表的时候,从列表的item项跳转到下一个页面,需要点击不同的列表跳转到不同的页面。
index.wxml
<view class="carts-item" wx:for="{{items}}" bindtap="navito" data-object-id="{{item.id}}">
<view class="carts-text">
<text class="carts-title">{{item.name}}</text>
</view>
index.js
data: {
items:[
{id:"1",name:"xxxxx"},
{id:"2",name:"yyyyy"},
],
Url:[
'../xxx/xxx',
'../yyy/yyy'
]
navito: function (e) {
// 点击不同的列表跳转到列表详情
var that=this;
var id = e.currentTarget.dataset.objectId-1;
wx.navigateTo({
url: that.data.Url[id]
});
}
许多列表跳转情况见大牛博客:https://blog.youkuaiyun.com/liona_koukou/article/details/52956058