在这里插入图片描述
比如参会人这一列,会有多个人名要展示

 <a-table       
          size="default"
          :columns="committeColumns"
          :dataSource="committeLoadData"
          :pagination="false"
        >        
          <template slot="Participants" slot-scope="text, record">
            <span v-for="(item, index) in record.attendee_list" :key="index"
              >{{ item.attendee_name }}
              <span v-if ="index!==record.attendee_list.length-1 "></span></span
            >
          </template>
        </a-table>

committeColumns中参会人这一项如下:

{
          width: '100px',
          title: '参会人',
          align: 'center',
          dataIndex: 'attendee_list',   
          scopedSlots: { customRender: 'Participants' }
        },

最主要的就是判断索引不是数组的最后一项,数组最后一项是数组.length-1
因为索引是从0开始,数组的长度是从1开始计算。
小细节,注意一下就好

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐