<el-table border :data="wxtableData" style="width: 100%">
//type="index" 是使用下标和v-for差不多
<el-table-column
type="index"
label="序号"
min-width="60"
align="center"
/>
//这是一个不使用插槽的单元格 他用prop使用wxtableData中的字段
<el-table-column prop="release" label="发布量" align="center" />
<el-table-column
label="公众号"
min-width="150"
align="center"
class-name="table-official"
>
//这个使用插槽在el-table-column中就不需要使用prop来绑定字段了
//用v-slot="scope",这时scope是当前整行的数据。所以下方在绑定时用scope.row.字段名
<template v-slot="scope">
<a :href="scope.row.homeDetailsUrl" target="_blank">{{
scope.row.homeDetailsName
}}</a>
</template>
</el-table-column>
<el-table-column prop="homeFans" label="粉丝数" align="center">
<template v-slot="scope">
{{ (scope.row.homeFans / 10000).toFixed(2) }}W+
</template>
</el-table-column>
<el-table-column prop="homeFocus" label="关注度" align="center" />
</el-table>
elementplus Table表格中使用template插槽
最新推荐文章于 2024-05-24 16:33:18 发布