element ui表格 表头的的特殊处理(换行/jsx风格表头)以及上传组件的一点小问题
<!--
* @Description:
* @Version: 2.0
* @Autor: lhl
* @Date: 2020-01-15 11:15:40
* @LastEditors: lhl
* @LastEditTime: xxx
-->
<template>
<div>
<el-table :data="tableData" style="width: 100%">
<el-table-column align="center" label="Date" prop="date"></el-table-column>
<el-table-column align="center" :label="'姓名\n(注:element ui 表格表头换行)'" prop="name"></el-table-column>
<el-table-column align="center" :render-header="renderHeader">
<template slot-scope="scope">
<span>{{scope.row.address}}</span>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import child from "./child";
export default {
components: {
child
},
data() {
return {
tableData: [
{
date: "2016-05-02",
name: "王小虎",
address: "上海市普陀区金沙江路 1518 弄"
},
{
date: "2016-05-04",
name: "王小虎",
address: "上海市普陀区金沙江路 1517 弄"
}
]
};
},
mounted() {
},
created() {
},
methods: {
renderHeader(h) {
return (
<div style="display: flex;justify-content: center;align-items: center;">
<div>地址</div>
<el-tooltip
class="item"
effect="dark"
content="tooltip的使用。"
placement="top"
>
<i class="el-icon-question"></i>
</el-tooltip>
</div>
);
}
}
};
</script>
<style lang="scss">
.el-table .cell{
white-space:pre-line;
}
</style>
使用element-ui el-upload上传图片,上传图片后再次打开还是会有原来的图片,想要清空原来上传的图片,只需要在组件上绑定 ref,在提交成功后的方法里调用 this.$refs.upload.clearFiles(); 就可以清除原来上传的文件;