如图所示的布局,让所有列表跳转到一个页面,在pages页面中设置跳转正常,做成components组件时,显示id值为空,请问这个id值怎么传?
代码:
components代码:
<!--components/indextitle/indextitle.wxml-->
<view class="title-list" >
<navigator class="title-group" wx:for="{{items}}" wx:key="item" url="{{listUrl}}" data-index="{{index}}" >
<image class="thumbnail" src="{{item.imgUrl}}" mode="" />
<text class="title">{{item.name}}</text>
</navigator>
</view>
js代码
properties: {
items:{
type:Object,
value:{}
},
listUrl:{
type:String,
value:''
},
index:{
type:Array,
value:[]
}
},
pages页面代码:
<indextitle items="{{title}}" listUrl="/pages/list/list?id={{index}}"></indextitle>
js代码:
data: {
title:[
{imgUrl:"../../images/automation.png",name:"自动化招聘"},
{imgUrl:"../../images/recruit-blue.png",name:"全职招聘"},
{imgUrl:"../../images/lin.png",name:"临时工招聘"},
{imgUrl:"../../images/part-tioe.png",name:"兼职招聘"},
{imgUrl:"../../images/graduates.png",name:"毕业生招聘"},
{imgUrl:"../../images/worker.png",name:"找工人"},
{imgUrl:"../../images/carpool-green.png",name:"拼车"},
{imgUrl:"../../images/invite.png",name:"邀请好友"},
],
},