vue中使用element 的表格时,表格数据有html标签,正确显示标签
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
作为小白,总容易遇见各种坑。下面来说一下问题和解决办法
下面这段代码是正常引用element的表格,
<el-table
:data="tableData"
style="width: 100%"
highlight-current-row
size:medium
>
<el-table-column
prop="date"
label="Domain"
width="180">
</el-table-column>
<el-table-column
prop="name"
label="System"
width="180">
</el-table-column>
<el-table-column
prop="address"
label="Creator">
</el-table-column>
<el-table-column
prop="name"
label="Remark"
width="180">
</el-table-column>
<el-table-column
prop="take"
label="Operating">
</el-table-column>
</el-table>
我想在最后一列td写html标签
data(){
return {
take:'<i class="iconfont icon-detail taskEntrance" value="132"></i><i class="iconfont icon-more active"></i>',
tableData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄',
take:'<i class="iconfont icon-detail taskEntrance" value="132"></i><i class="iconfont icon-more active"></i>'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄',
take:'<i class="iconfont icon-detail taskEntrance" value="132"></i><i class="iconfont icon-more active"></i>'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄',
take:'<i class="iconfont icon-detail taskEntrance" value="132"></i><i class="iconfont icon-more active"></i>'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄',
take:'<i class="iconfont icon-detail taskEntrance" value="132"></i><i class="iconfont icon-more active"></i>'
}]
}
},
解决办法:举一反三,看看table td里面button怎么加进去的
<el-table-column
prop="take"
label="Operating"
v-html="take">
<template slot-scope="scope">
<i class="el-icon-edit-outline"></i>
<i class="el-icon-tickets"></i>
<span>123</span>
<i class="iconfont icon-detail" style="height:20px;width:20px;font-size:10px;"></i>
</template>
</el-table-column>
template里面正常绑定什么的都可以了
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)