Skip to content

Commit 495e194

Browse files
authored
Merge pull request #918 from WeBankFinTech/feat-tree-style
feat(Tree): 节点选择箭头图标样式优化,增加点击区域
2 parents 803d9b2 + bec26f4 commit 495e194

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

components/tree/style/index.less

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
@tree-prefix-cls: ~'@{cls-prefix}-tree';
66
@tree-indent: 16px;
7-
@tree-switcher-width: 16px;
7+
@tree-switcher-width: calc(@font-size-head + @padding-xs);
88
@tree-selected-background-color: var(--f-hover-color-light);
99

1010
.@{tree-prefix-cls} {
@@ -73,10 +73,13 @@
7373
display: flex;
7474
align-items: center;
7575
justify-content: center;
76+
}
77+
&-node-checkbox {
7678
margin-right: @padding-xs;
7779
}
7880
&-node-switcher {
7981
width: @tree-switcher-width;
82+
padding-right: @padding-xs;
8083
font-size: @font-size-head;
8184
&.no-expand {
8285
width: 0; // 保留 margin-right,使得没有 switcher 的时候 tree node 仍有一定左边距

docs/.vitepress/components/tree/fix.vue

+17-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<script>
66
import { h, reactive } from 'vue';
7-
import { PictureOutlined, PlusCircleOutlined } from '@fesjs/fes-design/icon';
7+
import { AppstoreOutlined, PictureOutlined, PlusCircleOutlined } from '@fesjs/fes-design/icon';
88
99
function createData(level = 1, baseKey = '', prefix, suffix) {
1010
if (!level) {
@@ -13,7 +13,12 @@ function createData(level = 1, baseKey = '', prefix, suffix) {
1313
return Array.apply(null, { length: 2 }).map((_, index) => {
1414
const key = `${baseKey}${level}${index}`;
1515
return {
16-
label: createLabel(level),
16+
label: () => h('div', {
17+
class: 'fix-node-content',
18+
}, [
19+
createLabel(level),
20+
h(AppstoreOutlined),
21+
]),
1722
value: key,
1823
children: createData(level - 1, key, prefix, suffix),
1924
prefix: prefix ? () => h(PictureOutlined) : null,
@@ -47,3 +52,13 @@ export default {
4752
},
4853
};
4954
</script>
55+
56+
<style>
57+
.fix-node-content {
58+
display: flex;
59+
flex-direction: row;
60+
align-items: center;
61+
justify-content: start;
62+
gap: 5px;
63+
}
64+
</style>

0 commit comments

Comments
 (0)