diff --git a/examples/routers/table.vue b/examples/routers/table.vue index c9fdb31..9a9f96c 100644 --- a/examples/routers/table.vue +++ b/examples/routers/table.vue @@ -21,7 +21,11 @@ title: '姓名', key: 'name', width: 100, - fixed: 'left' + fixed: 'left', + sortable: true, + renderHeader: (h, params) => { + return h('Tag', params.index) + } }, { title: '年龄', diff --git a/src/components/table/header.js b/src/components/table/header.js new file mode 100644 index 0000000..ca3154a --- /dev/null +++ b/src/components/table/header.js @@ -0,0 +1,16 @@ +export default { + name: 'TableRenderHeader', + functional: true, + props: { + render: Function, + column: Object, + index: Number + }, + render: (h, ctx) => { + const params = { + column: ctx.props.column, + index: ctx.props.index + }; + return ctx.props.render(h, params); + } +}; \ No newline at end of file diff --git a/src/components/table/table-head.vue b/src/components/table/table-head.vue index 563e1d7..63d048b 100644 --- a/src/components/table/table-head.vue +++ b/src/components/table/table-head.vue @@ -10,7 +10,8 @@