可以看出我们产品规格对应的这个卡片是相当精美,其实是
el-table-column>template和el-tag的结晶
例如
productInfo值是 真皮;黑色;100;
那么我们在el-table中编写
<el-table-column align="center" label="产品规格" prop="productInfo">
<template #default="{ row }">
<span v-if="row.productInfo">
<div
v-for="(item, index) in row.productInfo.split(';')"
:key="index"
style="margin-top: 3%"
>
<el-tag v-if="item != ''">
{{ item }}
</el-tag>
</div>
</span>
</template>
</el-table-column>
就OK了