Skip to content

Commit 766bdc7

Browse files
authored
Merge pull request #52 from WeBankFinTech/branch_joy
feat: 水平布局组件加参defaultExpandAll,版本更新至1.11.2
2 parents 834202b + 2bf8f05 commit 766bdc7

File tree

5 files changed

+150
-2
lines changed

5 files changed

+150
-2
lines changed

docs/.vitepress/components/BHorizontalLayout/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,22 @@ app.use(BHorizontalLayout);
1515

1616
--CODE
1717

18+
19+
### 设置默认菜单项全部展开
20+
21+
--USEEXPANDALL
22+
23+
1824
## 参数说明
1925
### BHorizontalLayout Props
2026
| 属性 | 说明 | 类型 | 默认值 |是否必须|
2127
| ----- | ----------------------------- | ---------------------------------------- |------------------ |----- |
2228
| curPath | 当前路径 | String|''| 是
2329
| menus | 菜单列表 | Array(object)|[]| 是
30+
| defaultExpandAll | 是否默认展开全部菜单,当curPath有值时,defaultExpandAll将失效 | boolean|false| 否
2431
| isFoot | 是否展示页脚 | Boolean|true| 否
2532
| footText | 页脚内容 | String|WeDataSphere版权所有| 否
33+
2634
### BHorizontalLayout Events
2735
| 事件名称 | 说明 | 回调参数 |
2836
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<template>
2+
<div style="height: 500px">
3+
<BHorizontalLayout v-model:curPath="currentPath" :menus="menus" @menuChange="onMenuClick" @sideBarCollapse="onSideBarCollapse" footText="自定义注脚" :defaultExpandAll="true">
4+
<template v-slot:top>
5+
顶部内容
6+
</template>
7+
<template v-slot:container>
8+
<div>
9+
右侧容器内容使用slot插槽,
10+
当前选择菜单路径:{{currentPath}}
11+
</div>
12+
</template>
13+
</BHorizontalLayout>
14+
</div>
15+
</template>
16+
<script setup lang="ts">
17+
import { ref, h} from 'vue';
18+
import { BHorizontalLayout } from '@fesjs/traction-widget';
19+
import { AppstoreOutlined, DateOutlined,ClusterOutlined, SettingOutlined } from '@fesjs/fes-design/icon';
20+
21+
const currentPath = ref<string>('');
22+
const menus = ref([{
23+
label: '任务查询',
24+
value: '/tasks',
25+
icon: () => h(AppstoreOutlined),
26+
}, {
27+
label: '我的项目',
28+
value: '/rules',
29+
icon: () => h(SettingOutlined),
30+
children: [{
31+
label: '规则查询一个很长想看下省略效果的标题',
32+
value: '/rules/query1',
33+
icon: () => h(DateOutlined),
34+
children: [{
35+
label: '规则查询一个很长想看下省略效果的标题',
36+
value: '/rules/query2',
37+
icon: () => h(DateOutlined),
38+
}, {
39+
label: '规则模板',
40+
value: '/rules/template3',
41+
icon: () => h(ClusterOutlined),
42+
children: [{
43+
label: '规则查询一个很长想看下省略效果的标题',
44+
value: '/rules/query4',
45+
icon: () => h(DateOutlined),
46+
children: [{
47+
label: '规则查询一个很长想看下省略效果的标题',
48+
value: '/rules/query5',
49+
icon: () => h(DateOutlined),
50+
}, {
51+
label: '规则模板',
52+
value: '/rules/template6',
53+
icon: () => h(ClusterOutlined),
54+
}]
55+
}, {
56+
label: '规则模板',
57+
value: '/rules/template7',
58+
icon: () => h(ClusterOutlined),
59+
}]
60+
}]
61+
}, {
62+
label: '规则模板',
63+
value: '/rules/template8',
64+
icon: () => h(ClusterOutlined),
65+
}]
66+
},{
67+
label: '我的项目2',
68+
value: '/rules2',
69+
icon: () => h(SettingOutlined),
70+
children: [{
71+
label: '规则查询一个很长想看下省略效果的标题2',
72+
value: '/rules2/query',
73+
icon: () => h(DateOutlined),
74+
}, {
75+
label: '规则模板2',
76+
value: '/rules2/template',
77+
icon: () => h(ClusterOutlined),
78+
}]
79+
},
80+
{
81+
label: '任务查询1',
82+
value: '/tasks1',
83+
icon: () => h(AppstoreOutlined),
84+
},{
85+
label: '任务查询2',
86+
value: '/tasks2',
87+
icon: () => h(AppstoreOutlined),
88+
},{
89+
label: '任务查询3',
90+
value: '/tasks3',
91+
icon: () => h(AppstoreOutlined),
92+
},{
93+
label: '任务查询4',
94+
value: '/tasks4',
95+
icon: () => h(AppstoreOutlined),
96+
},{
97+
label: '任务查询5',
98+
value: '/tasks5',
99+
icon: () => h(AppstoreOutlined),
100+
},{
101+
label: '任务查询6',
102+
value: '/tasks6',
103+
icon: () => h(AppstoreOutlined),
104+
},{ label: '任务查询7',
105+
value: '/tasks7',
106+
icon: () => h(AppstoreOutlined),
107+
},{ label: '任务查询8',
108+
value: '/tasks8',
109+
icon: () => h(AppstoreOutlined),
110+
},{ label: '任务查询9',
111+
value: '/tasks9',
112+
icon: () => h(AppstoreOutlined),
113+
},{
114+
label: '任务查询10',
115+
value: '/tasks10',
116+
icon: () => h(AppstoreOutlined),
117+
}]);
118+
119+
const onMenuClick = (v: any) => {
120+
currentPath.value = v.value;
121+
console.log('onMenuClick-菜单跳转', currentPath.value);
122+
};
123+
124+
const onSideBarCollapse = (v:Boolean) => {
125+
if (v) {
126+
console.log('侧边栏折叠')
127+
} else {
128+
console.log('侧边栏展开')
129+
}
130+
}
131+
</script>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fesjs/traction-widget",
3-
"version": "1.11.1",
3+
"version": "1.11.2",
44
"description": "集合大型中台项目使用到的通用组件和工具函数",
55
"scripts": {
66
"docs:dev": "npm run build && node docs/.vitepress/scripts/generate-doc.js && vitepress dev docs",

packages/traction-widget/components/HorizontalLayout/HorizontalLayout.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
:collapsed="isSideBarCollapse"
1313
@select="onMenuClick"
1414
:expandedKeys="expandedKeys"
15+
:defaultExpandAll="defaultExpandAll"
1516
></FMenu>
1617
</div>
1718
<div class="collapse-btn" @click="toggleSideBar">
@@ -48,6 +49,14 @@ const props = defineProps({
4849
require: true,
4950
default: () => []
5051
},
52+
53+
// 是否默认展开全部菜单项
54+
defaultExpandAll: {
55+
type: Boolean,
56+
require: false,
57+
default: false
58+
},
59+
5160
// 是否展示注脚
5261
isFoot: {
5362
type: Boolean,

packages/traction-widget/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fesjs/traction-widget",
3-
"version": "1.11.1",
3+
"version": "1.11.2",
44
"description": "集合大型中台项目使用到的通用组件和工具函数",
55
"main": "dist/traction-widget.min.js",
66
"module": "es/components/index.js",

0 commit comments

Comments
 (0)