wxml:
<view class="navRight">
<block wx:for="{{categoryData}}">
<view class="navRight-main-item" wx:if="{{currentIndex == index}}">
<block wx:for="{{item.list}}" wx:for-item="subitem">
<view class="navRight-main-item-list">
<block wx:for="{{subitem.subList}}" wx:for-item="descitem" >
<navigator data-img="{{descitem.descUrl}}" data-text="{{descitem.descTitlt}}" bindtap="navigateToApple">
<image src="{{descitem.descUrl}}"></image>
<text>{{descitem.descTitlt}}</text>
</navigator>
</block>
</view>
</block>
</view>
</block>
</view>
js:
var categoryData={
"code":1,
"success":"ok",
"data":
[
{
"title":"苹果",
"list":
[
{
"subList":
[
{
descTitlt:"苹果",
descUrl:"/images/small_apple.jpeg"
}
]
}
]
},
{
"title":"葡萄",
"list":
[
{
"subList":
[
{
descTitlt:"葡萄",
descUrl:""
}
]
}
]
},
{
"title":"敬请期待",
"list":
[
{
"subList":[]
}
]
}
]
}
export default categoryData;
绑定点击事件跳转,在元素上绑定一个属性,点击事件获取属性判断是那个元素,跳转相应页面