Skip to content

Commit

Permalink
feat(Tree): 节点选择箭头图标样式优化,增加点击区域
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean-gao committed Dec 4, 2024
1 parent 8029e7c commit bec26f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion components/tree/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

.@{tree-prefix-cls} {
Expand Down Expand Up @@ -73,10 +73,13 @@
display: flex;
align-items: center;
justify-content: center;
}
&-node-checkbox {
margin-right: @padding-xs;
}
&-node-switcher {
width: @tree-switcher-width;
padding-right: @padding-xs;
font-size: @font-size-head;
&.no-expand {
width: 0; // 保留 margin-right,使得没有 switcher 的时候 tree node 仍有一定左边距
Expand Down
19 changes: 17 additions & 2 deletions docs/.vitepress/components/tree/fix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
import { h, reactive } from 'vue';
import { PictureOutlined, PlusCircleOutlined } from '@fesjs/fes-design/icon';
import { AppstoreOutlined, PictureOutlined, PlusCircleOutlined } from '@fesjs/fes-design/icon';
function createData(level = 1, baseKey = '', prefix, suffix) {
if (!level) {
Expand All @@ -13,7 +13,12 @@ function createData(level = 1, baseKey = '', prefix, suffix) {
return Array.apply(null, { length: 2 }).map((_, index) => {
const key = `${baseKey}${level}${index}`;
return {
label: createLabel(level),
label: () => h('div', {
class: 'fix-node-content',
}, [
createLabel(level),
h(AppstoreOutlined),
]),
value: key,
children: createData(level - 1, key, prefix, suffix),
prefix: prefix ? () => h(PictureOutlined) : null,
Expand Down Expand Up @@ -47,3 +52,13 @@ export default {
},
};
</script>

<style>
.fix-node-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: start;
gap: 5px;
}
</style>

0 comments on commit bec26f4

Please sign in to comment.