elementUI table 数组中各项加逗号隔开

js处理

//this.newTableData 数组 
            this.newTableData.map((item,index)=>{
                //item.label 数组
                if(item.label){
                    item.label = item.label.join(',');
                }
            })

element UI table 中用插槽实现:

<el-table-column prop="label" label="客群标签">
					<template slot-scope="scope">
						<div class="label-ceil">
							<div v-for="(item,ind) in scope.row.label" :key="ind">
								<span v-if="ind+1 == scope.row.label.length">{{item}} </span>
								<span v-else>{{item}},</span>
							</div>
						</div>
					</template>
				</el-table-column>

  数组最后一个不加逗号

posted @ 2022-11-08 15:47  烂笔头~  Views(200)  Comments(0Edit  收藏  举报