feat(advance-table): add renderHeader in column

This commit is contained in:
JiwenBai 2019-10-16 13:54:51 +08:00
parent f2dd5cd177
commit 871960ee87
3 changed files with 16 additions and 4 deletions

View File

@ -6,6 +6,8 @@
多选删除(注意:data数据发生变化后,多选的状态将会被清空)
<br>
行添加className
<br>
自定义渲染头
</div>
<div
class="n-doc-section__view"
@ -87,7 +89,10 @@ const _columns3 = ($this) => {
title: 'Name',
key: 'name',
sortable: true,
width: 300
width: 300,
renderHeader(h,column){
return <n-tag>{column.title}</n-tag>
}
},
{
title: 'Age',

View File

@ -10,9 +10,9 @@ export default {
render: (h, ctx) => {
const params = ctx.props.row
const { keyName, render, row } = ctx.props
const { keyName, render } = ctx.props
if (render) {
return h('div', [render(h, params)])
return render(h, params)
} else return h('div', [params.row[keyName]])
}
}

View File

@ -71,7 +71,14 @@
:indeterminate="!isCheckedBoxAllIndeterminate"
@click.native="onAllCheckboxesClick"
/>
{{ column.title }}
<row
v-if="column.renderHeader"
:index="i"
:row="column"
:key-name="column.key || i"
:render="column.renderHeader"
/>
{{ !column.renderHeader ? column.title : '' }}
<SortIcon
v-if="column.sortable"
:ref="'sorter_' + (column.key || i)"