Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
京东前端
nutui
提交
2ad539ee
N
nutui
项目概览
京东前端
/
nutui
通知
37
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nutui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2ad539ee
编写于
5月 29, 2022
作者:
X
xch1029
提交者:
GitHub
5月 29, 2022
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
table支持自定义表头icon、支持render入参等 (#1261)
* feat(table): 支持自定义表头icon
上级
e5bd93bc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
8 deletion
+28
-8
src/packages/__VUE/table/demo.vue
src/packages/__VUE/table/demo.vue
+13
-4
src/packages/__VUE/table/index.vue
src/packages/__VUE/table/index.vue
+12
-2
src/packages/__VUE/table/renderColumn.ts
src/packages/__VUE/table/renderColumn.ts
+3
-2
未找到文件。
src/packages/__VUE/table/demo.vue
浏览文件 @
2ad539ee
...
...
@@ -22,6 +22,12 @@
<nut-table
:columns=
"columns3"
:data=
"data5"
>
</nut-table>
<h2>
支持排序
</h2>
<nut-table
:columns=
"columns6"
:data=
"data6"
@
sorter=
"handleSorter"
>
</nut-table>
<h2>
支持自定义表头icon
</h2>
<nut-table
:columns=
"columns1"
:data=
"data1"
>
<
template
#icon-name
>
<nut-icon
name=
"people"
></nut-icon>
</
template
>
</nut-table>
</div>
</template>
...
...
@@ -98,7 +104,10 @@ export default createDemo({
{
title
:
'
姓名
'
,
key
:
'
name
'
,
align
:
'
center
'
align
:
'
center
'
,
render
(
data
)
{
return
`
${
data
.
name
}
(
${
data
.
sex
}
)`
;
}
},
{
title
:
'
性别
'
,
...
...
@@ -182,7 +191,8 @@ export default createDemo({
name
:
'
Tom
'
,
sex
:
'
男
'
,
record
:
'
小学
'
,
render
:
()
=>
{
render
:
(
data
)
=>
{
console
.
log
(
data
);
return
h
(
Button
,
{
...
...
@@ -247,8 +257,7 @@ export default createDemo({
timer
:
null
as
number
|
null
,
summary
:
()
=>
{
return
{
value
:
'
这是总结栏
'
,
colspan
:
5
value
:
'
这是总结栏
'
};
}
});
...
...
src/packages/__VUE/table/index.vue
浏览文件 @
2ad539ee
...
...
@@ -12,7 +12,12 @@
>
{{
item
.
title
}}
<slot
name=
"icon"
></slot>
<nut-icon
v-if=
"!$slots.icon && item.sorter"
name=
"down-arrow"
size=
"12px"
></nut-icon>
<slot
:name=
"`icon-$
{item.key}`">
</slot>
<nut-icon
v-if=
"!$slots.icon && !$slots[`icon-$
{item.key}`]
&&
item.sorter"
name="down-arrow"
size="12px"
>
</nut-icon>
</span>
</view>
</view>
...
...
@@ -25,7 +30,12 @@
:key=
"value"
>
{{
typeof
item
[
value
]
!==
'
function
'
?
item
[
value
]
:
''
}}
<RenderColumn
:slots=
"item[value]"
v-if=
"typeof item[value] === 'function'"
></RenderColumn>
<RenderColumn
:slots=
"item[value]"
:data=
"item"
v-if=
"typeof item[value] === 'function'"
></RenderColumn>
<RenderColumn
:slots=
"getColumnItem(value).render"
:data=
"item"
v-else-if=
"typeof getColumnItem(value).render === 'function'"
></RenderColumn>
</span>
</view>
</view>
...
...
src/packages/__VUE/table/renderColumn.ts
浏览文件 @
2ad539ee
import
{
h
}
from
'
vue
'
;
export
default
{
setup
(
props
:
any
)
{
return
()
=>
h
(
`view`
,
{},
props
.
slots
());
return
()
=>
h
(
`view`
,
{},
props
.
slots
(
props
.
data
));
},
props
:
{
slots
:
Object
slots
:
Object
,
data
:
Object
}
};
richard_1015
@u011978868
mentioned in commit
77262554
·
5月 30, 2022
mentioned in commit
77262554
mentioned in commit 77262554abc36470a816f72c7e2d206da346d4b6
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录