安徽企业平台网站建设网页在线秒收录
问题
elementui 中的 table 行内的内容不能进行换行。
解决方法
思路:
利用 作用域插槽 结合 v-html,通过作用域插槽传递内容到表格行内,再通过 v-html 进行内容的替换。
代码:
<el-table:data="tableData"stripestyle="width: 100%"@row-click="handleTableRow"border><el-table-column prop="project" label="项目" width="290"><template slot-scope="scope"><div v-html="scope.row.content"></div></template></el-table-column>
</el-table><script>
export default {data() {return {tableData: [{project: "aaa<br/>111"},{project: "bbb<br/>222"},]}}
}
</script>