龙鱼好养吗
有这样⼀个需求element+vue实现显⽰的table的表头添加⼀个添
加图标,并绑定⼀个。。。
有这样⼀个需求 element +vue 实现显⽰的table 的表头添加⼀个添加图标,并绑定⼀个点击事件,我查了好多资料,终于找到table 表头的⼀个事件 :render-header 可以实现。
代码html
<el-table-column fixed="left" width="65px" :render-header="renderHeader">
<template slot-scope="scope">
<el-button @click.native.prevent="deleteRow(scope.$index, formDetail.taxEntityList)"
size="small"><i class="el-icon-remove-outline"></i></el-button>
人才工作会议</template>
</el-table-column>
</el-table>
js:
methods: {
隧道英语
梦见吃面条renderHeader(h, { column, $index }){
return h('div', null,[
qq星座运势
h('span',null,[
香蕉孕妇能吃吗h('i',{class :'el-icon-circle-plus-outline', on:{
退票
click: function () {
vm.addRow();
}优秀毕业生申请书
}},''
)
]
),
])
}
}
js的意思就是添加⼀个div ⾥⾯有个span , span⾥⾯加⼀个<i class="el-icon-circle-plus-outline"></i>图⽚的class,on 后⾯的是绑定⼀个点击事件。注意返回的h(),第三个参数是个数组,就好似⼀个div⾥⾯有多个标签;
蓝⾊的意思是每⼀⾏有⼀个删除图⽚的按钮,点击删除