mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-18 12:34:25 +08:00
feat:(advance-table): add renderHeader in column ,merge pull request #9 from jiwen-bai/develop
feat:(advance-table): add renderHeader in column
This commit is contained in:
commit
b51a8fa18f
@ -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',
|
||||
|
@ -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]])
|
||||
}
|
||||
}
|
||||
|
@ -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)"
|
||||
|
Loading…
Reference in New Issue
Block a user