element-ui 表格 el-table 绑定字段实现点击下载文件:
绑定数据代码:
<template v-for="item in cell.tableData">
<el-table-column
v-if="!item.show"
:key="item.prop"
:prop="item.prop"
:label="item.label"
:width="item.width"
:formatter="downStr"
></el-table-column>
</template>
formatter 事件:
downStr(row, column) {
if (column.property == "filePath") {
//return row.filePath;
return (
<a href={row.filePath} target="_blank">
点击下载
</a>
);
}
return row[column.property];
}
效果:
相关阅读 >>
element-ui 表格 el-table 绑定字段实现点击下载文件
更多相关阅读请进入《element-ui》频道 >>
Vue.js 设计与实现 基于Vue.js 3 深入解析Vue.js 设计细节
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者