收藏
回答

微信小程序for循环模板template里面怎么得到for循环的下标index呢

//for循环模板postItem 

<block wx:for="{{postList}}" wx:for-item="item" wx:for-index="idx">

<template is="postItem" data="{{...item}}"/>

</block>


//template模板获取for循环里的下标idx的值     

<template name="postItem">

    <text class="post-title">{{idx}}</text>

</template>


//现在问题是模板里获取不到for循环里的下标idx


回答关注问题邀请回答
收藏

2 个回答

  • Ming
    Ming
    2018-02-14

    可以了,谢谢

    2018-02-14
    有用
    回复
  • 卢索
    卢索
    2018-02-13

    https://developers.weixin.qq.com/blogdetail?action=get_post_info&docid=9412f5ddb4a426747836a7fd49b6baf6&highline=小程序%20template%20wx%3Afor%20index&token=1019146719&lang=zh_CN

    2018-02-13
    有用
    回复
登录 后发表内容