实现效果如下:
使用作用域插槽来自定义每个单元格的内容:使用了 slot-scope 来获取作用域变量 scope。
<template>
<el-table :data="tableData">
<el-table-column label="链接" prop="link">
<template slot-scope="scope">
<el-link>
{{ scope.row.link }}
</el-link>
</template>
</el-table-column>
</el-table>
</template>
<script>
export default {
data() {
return {
tableData: [
{ id: '123', link: 'file1.pdf'},
],
};
},
};
</script>