jianghu-ui 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +376 -0
- package/dist/jianghu-ui.css +2318 -0
- package/dist/jianghu-ui.js +2 -0
- package/dist/jianghu-ui.js.LICENSE.txt +1 -0
- package/package.json +56 -0
- package/src/Design.stories.mdx +195 -0
- package/src/Introduction.stories.mdx +148 -0
- package/src/components/JhAddressSelect/JhAddressSelect.md +250 -0
- package/src/components/JhAddressSelect/JhAddressSelect.stories.js +282 -0
- package/src/components/JhAddressSelect/JhAddressSelect.vue +261 -0
- package/src/components/JhCard/JhCard.md +246 -0
- package/src/components/JhCard/JhCard.stories.js +688 -0
- package/src/components/JhCard/JhCard.vue +604 -0
- package/src/components/JhCheckCard/JhCheckCard.md +245 -0
- package/src/components/JhCheckCard/JhCheckCard.stories.js +750 -0
- package/src/components/JhCheckCard/JhCheckCard.vue +476 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.md +70 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.stories.js +550 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.vue +181 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.md +56 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.stories.js +320 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.vue +307 -0
- package/src/components/JhDescriptions/JhDescriptions.md +724 -0
- package/src/components/JhDescriptions/JhDescriptions.stories.js +858 -0
- package/src/components/JhDescriptions/JhDescriptions.vue +933 -0
- package/src/components/JhDraggable/JhDraggable.md +66 -0
- package/src/components/JhDraggable/JhDraggable.stories.js +161 -0
- package/src/components/JhDraggable/JhDraggable.vue +254 -0
- package/src/components/JhDrawer/JhDrawer.md +68 -0
- package/src/components/JhDrawer/JhDrawer.stories.js +478 -0
- package/src/components/JhDrawer/JhDrawer.vue +281 -0
- package/src/components/JhDrawerForm/JhDrawerForm.md +69 -0
- package/src/components/JhDrawerForm/JhDrawerForm.stories.js +492 -0
- package/src/components/JhDrawerForm/JhDrawerForm.vue +297 -0
- package/src/components/JhEditableTable/JhEditableTable.md +507 -0
- package/src/components/JhEditableTable/JhEditableTable.stories.js +615 -0
- package/src/components/JhEditableTable/JhEditableTable.vue +685 -0
- package/src/components/JhFileInput/JhFileInput.md +56 -0
- package/src/components/JhFileInput/JhFileInput.stories.js +103 -0
- package/src/components/JhFileInput/JhFileInput.vue +253 -0
- package/src/components/JhForm/JhForm.md +676 -0
- package/src/components/JhForm/JhForm.stories.js +1375 -0
- package/src/components/JhForm/JhForm.vue +657 -0
- package/src/components/JhFormField/JhFormField.stories.js +217 -0
- package/src/components/JhFormField/JhFormField.vue +439 -0
- package/src/components/JhFormFields/JhFormFields.md +647 -0
- package/src/components/JhFormFields/JhFormFields.stories.js +922 -0
- package/src/components/JhFormFields/JhFormFields.vue +998 -0
- package/src/components/JhFormList/JhFormList.md +303 -0
- package/src/components/JhFormList/JhFormList.stories.js +661 -0
- package/src/components/JhFormList/JhFormList.vue +1127 -0
- package/src/components/JhJsonEditor/JhJsonEditor.md +54 -0
- package/src/components/JhJsonEditor/JhJsonEditor.stories.js +157 -0
- package/src/components/JhJsonEditor/JhJsonEditor.vue +178 -0
- package/src/components/JhLayout/JhLayout.md +580 -0
- package/src/components/JhLayout/JhLayout.stories.js +414 -0
- package/src/components/JhLayout/JhLayout.vue +387 -0
- package/src/components/JhList/JhList.md +441 -0
- package/src/components/JhList/JhList.stories.js +524 -0
- package/src/components/JhList/JhList.vue +571 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +56 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.stories.js +191 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.vue +188 -0
- package/src/components/JhMask/JhMask.md +62 -0
- package/src/components/JhMask/JhMask.stories.js +270 -0
- package/src/components/JhMask/JhMask.vue +123 -0
- package/src/components/JhMenu/JhMenu.md +85 -0
- package/src/components/JhMenu/JhMenu.stories.js +384 -0
- package/src/components/JhMenu/JhMenu.vue +545 -0
- package/src/components/JhModal/JhModal.md +68 -0
- package/src/components/JhModal/JhModal.stories.js +562 -0
- package/src/components/JhModal/JhModal.vue +235 -0
- package/src/components/JhModalForm/JhModalForm.md +69 -0
- package/src/components/JhModalForm/JhModalForm.stories.js +592 -0
- package/src/components/JhModalForm/JhModalForm.vue +298 -0
- package/src/components/JhPageContainer/JhPageContainer.md +409 -0
- package/src/components/JhPageContainer/JhPageContainer.stories.js +209 -0
- package/src/components/JhPageContainer/JhPageContainer.vue +72 -0
- package/src/components/JhQueryFilter/JhQueryFilter.md +77 -0
- package/src/components/JhQueryFilter/JhQueryFilter.stories.js +684 -0
- package/src/components/JhQueryFilter/JhQueryFilter.vue +429 -0
- package/src/components/JhScene/JhScene.md +64 -0
- package/src/components/JhScene/JhScene.stories.js +317 -0
- package/src/components/JhScene/JhScene.vue +376 -0
- package/src/components/JhStatisticCard/JhStatisticCard.md +363 -0
- package/src/components/JhStatisticCard/JhStatisticCard.stories.js +847 -0
- package/src/components/JhStatisticCard/JhStatisticCard.vue +459 -0
- package/src/components/JhStepsForm/JhStepsForm.md +666 -0
- package/src/components/JhStepsForm/JhStepsForm.stories.js +1224 -0
- package/src/components/JhStepsForm/JhStepsForm.vue +749 -0
- package/src/components/JhTable/JhTable.md +730 -0
- package/src/components/JhTable/JhTable.stories.js +1444 -0
- package/src/components/JhTable/JhTable.vue +2298 -0
- package/src/components/JhTableAttachment/JhTableAttachment.md +70 -0
- package/src/components/JhTableAttachment/JhTableAttachment.stories.js +198 -0
- package/src/components/JhTableAttachment/JhTableAttachment.vue +264 -0
- package/src/components/JhToast/JhToast.md +67 -0
- package/src/components/JhToast/JhToast.stories.js +386 -0
- package/src/components/JhToast/JhToast.vue +239 -0
- package/src/components/JhTreeSelect/JhTreeSelect.md +82 -0
- package/src/components/JhTreeSelect/JhTreeSelect.stories.js +391 -0
- package/src/components/JhTreeSelect/JhTreeSelect.vue +727 -0
- package/src/components/JhWaterMark/JhWaterMark.md +190 -0
- package/src/components/JhWaterMark/JhWaterMark.stories.js +675 -0
- package/src/components/JhWaterMark/JhWaterMark.vue +351 -0
- package/src/components/README.md +52 -0
- package/src/index.js +135 -0
- package/src/style/globalCSSJHV4.css +348 -0
- package/src/style/globalCSSVuetifyV4.css +637 -0
- package/src/style/storybook.css +4 -0
- package/src/tailwind.css +3 -0
- package/src/utils/vuetify.js +31 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-overlay
|
|
3
|
+
:value="value"
|
|
4
|
+
:opacity="opacity"
|
|
5
|
+
:color="color"
|
|
6
|
+
:z-index="zIndex"
|
|
7
|
+
@click="handleClick"
|
|
8
|
+
>
|
|
9
|
+
<slot>
|
|
10
|
+
<v-progress-circular
|
|
11
|
+
v-if="showLoading"
|
|
12
|
+
:size="loadingSize"
|
|
13
|
+
:width="loadingWidth"
|
|
14
|
+
:color="loadingColor"
|
|
15
|
+
indeterminate
|
|
16
|
+
></v-progress-circular>
|
|
17
|
+
</slot>
|
|
18
|
+
</v-overlay>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
name: 'JhMask',
|
|
24
|
+
props: {
|
|
25
|
+
// 是否显示遮罩
|
|
26
|
+
value: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
// 背景颜色
|
|
31
|
+
color: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '#e3e3e3',
|
|
34
|
+
},
|
|
35
|
+
// 透明度 (0-1)
|
|
36
|
+
opacity: {
|
|
37
|
+
type: [Number, String],
|
|
38
|
+
default: 0.8,
|
|
39
|
+
validator: (v) => {
|
|
40
|
+
const num = parseFloat(v);
|
|
41
|
+
return num >= 0 && num <= 1;
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
// z-index
|
|
45
|
+
zIndex: {
|
|
46
|
+
type: [Number, String],
|
|
47
|
+
default: 300,
|
|
48
|
+
},
|
|
49
|
+
// 是否显示 loading 动画
|
|
50
|
+
showLoading: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
// loading 大小
|
|
55
|
+
loadingSize: {
|
|
56
|
+
type: [Number, String],
|
|
57
|
+
default: 64,
|
|
58
|
+
},
|
|
59
|
+
// loading 宽度
|
|
60
|
+
loadingWidth: {
|
|
61
|
+
type: [Number, String],
|
|
62
|
+
default: 7,
|
|
63
|
+
},
|
|
64
|
+
// loading 颜色
|
|
65
|
+
loadingColor: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'primary',
|
|
68
|
+
},
|
|
69
|
+
// 点击遮罩是否关闭
|
|
70
|
+
closeOnClick: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
74
|
+
// 自动关闭时间 (毫秒), 0 表示不自动关闭
|
|
75
|
+
timeout: {
|
|
76
|
+
type: Number,
|
|
77
|
+
default: 0,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
data() {
|
|
81
|
+
return {
|
|
82
|
+
timer: null,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
watch: {
|
|
86
|
+
value(newVal) {
|
|
87
|
+
if (newVal && this.timeout > 0) {
|
|
88
|
+
this.startTimer();
|
|
89
|
+
} else if (!newVal) {
|
|
90
|
+
this.clearTimer();
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
beforeDestroy() {
|
|
95
|
+
this.clearTimer();
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
handleClick() {
|
|
99
|
+
if (this.closeOnClick) {
|
|
100
|
+
this.$emit('input', false);
|
|
101
|
+
this.$emit('click');
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
startTimer() {
|
|
105
|
+
this.clearTimer();
|
|
106
|
+
this.timer = setTimeout(() => {
|
|
107
|
+
this.$emit('input', false);
|
|
108
|
+
this.$emit('timeout');
|
|
109
|
+
}, this.timeout);
|
|
110
|
+
},
|
|
111
|
+
clearTimer() {
|
|
112
|
+
if (this.timer) {
|
|
113
|
+
clearTimeout(this.timer);
|
|
114
|
+
this.timer = null;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<style scoped>
|
|
122
|
+
/* 自定义样式可以在这里添加 */
|
|
123
|
+
</style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# JhMenu - 响应式导航菜单
|
|
2
|
+
|
|
3
|
+
JhMenu 提供桌面/移动端统一的导航栏,集成多级菜单、右侧自定义菜单及用户头像菜单,适合后台管理与工作台场景。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 📱 **响应式布局**:自动在移动端显示抽屉菜单与头像抽屉
|
|
8
|
+
- 🌲 **多级菜单**:支持至多三级结构,含折叠/展开交互
|
|
9
|
+
- 🧭 **多入口组合**:左侧主菜单、右侧快捷菜单、头像下拉菜单可同时存在
|
|
10
|
+
- 🔔 **状态同步**:通过 `activeMenuIndex/activeSecondMenuId` 控制当前高亮
|
|
11
|
+
- 🔒 **账号信息展示**:内置用户名、角色标签、登出操作
|
|
12
|
+
|
|
13
|
+
## 基础用法
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<jh-menu
|
|
18
|
+
:app-title="'工作台'"
|
|
19
|
+
:menu-list="menus"
|
|
20
|
+
:right-menu-list="[{ title: '帮助', icon: 'mdi-help-circle' }]"
|
|
21
|
+
:avatar-menu-list="[{ title: '个人设置', id: 'profile' }]"
|
|
22
|
+
:user-info="user"
|
|
23
|
+
@menu-click="handleMenu"
|
|
24
|
+
@logout="logout"
|
|
25
|
+
/>
|
|
26
|
+
</template>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
### Props
|
|
32
|
+
|
|
33
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| appTitle | 应用标题 | string | `JianghuJS` |
|
|
36
|
+
| menuList | 左侧多级菜单数据 | Array | [] |
|
|
37
|
+
| rightMenuList | 顶部右侧快捷菜单数据 | Array | [] |
|
|
38
|
+
| avatarMenuList | 头像下拉菜单数据 | Array | [] |
|
|
39
|
+
| userInfo | 用户信息 `{ username,userId,roles }` | Object | `{ username: 'Guest', userId: '', roles: [] }` |
|
|
40
|
+
| showAvatar | 是否展示头像区域 | boolean | true |
|
|
41
|
+
| activeMenuIndex | 当前激活的一级菜单索引 | number | -1 |
|
|
42
|
+
| activeSecondMenuId | 当前激活的二级/三级菜单 id | string | null |
|
|
43
|
+
| temporary | 移动端抽屉是否点击遮罩关闭 | boolean | true |
|
|
44
|
+
| hideDrawers | Storybook 模式下隐藏抽屉 | boolean | false |
|
|
45
|
+
|
|
46
|
+
### Events
|
|
47
|
+
|
|
48
|
+
| 事件名 | 说明 | 回调参数 |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| menu-click | 任意菜单被点击时触发 | (menuItem: object, index?: number) |
|
|
51
|
+
| logout | 点击登出按钮时触发 | - |
|
|
52
|
+
|
|
53
|
+
### Slots
|
|
54
|
+
|
|
55
|
+
该组件不暴露插槽,如需扩展请在 `menuList/rightMenuList` 数据中配置。
|
|
56
|
+
|
|
57
|
+
## 数据结构示例
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
const menus = [
|
|
61
|
+
{
|
|
62
|
+
title: '首页',
|
|
63
|
+
id: 'home',
|
|
64
|
+
path: '/dashboard'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: '系统管理',
|
|
68
|
+
children: [
|
|
69
|
+
{ title: '用户管理', id: 'user', path: '/user' },
|
|
70
|
+
{
|
|
71
|
+
title: '审批',
|
|
72
|
+
children: [
|
|
73
|
+
{ title: '流程列表', id: 'flow', path: '/flow' }
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 使用建议
|
|
82
|
+
|
|
83
|
+
- 通过 `menu-item.active` 字段可默认展开某个有子级的菜单
|
|
84
|
+
- 所有菜单项建议带上唯一 `id`,方便与二级高亮、埋点等逻辑关联
|
|
85
|
+
- 移动端建议搭配 `temporary=true`,以便点击遮罩快速收起抽屉
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import JhMenu from './JhMenu.vue';
|
|
2
|
+
|
|
3
|
+
// 示例菜单数据
|
|
4
|
+
const sampleMenuList = [
|
|
5
|
+
{
|
|
6
|
+
id: 'dashboard',
|
|
7
|
+
title: '首页',
|
|
8
|
+
path: '/dashboard',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: 'users',
|
|
12
|
+
title: '用户管理',
|
|
13
|
+
children: [
|
|
14
|
+
{ id: 'user-list', title: '用户列表', path: '/users/list' },
|
|
15
|
+
{ id: 'user-roles', title: '角色管理', path: '/users/roles' },
|
|
16
|
+
{ id: 'user-permissions', title: '权限管理', path: '/users/permissions' },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'content',
|
|
21
|
+
title: '内容管理',
|
|
22
|
+
children: [
|
|
23
|
+
{ id: 'articles', title: '文章管理', path: '/content/articles' },
|
|
24
|
+
{ id: 'categories', title: '分类管理', path: '/content/categories' },
|
|
25
|
+
{ id: 'tags', title: '标签管理', path: '/content/tags' },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'settings',
|
|
30
|
+
title: '系统设置',
|
|
31
|
+
path: '/settings',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'help',
|
|
35
|
+
title: '帮助文档',
|
|
36
|
+
path: '/help',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const sampleRightMenuList = [
|
|
41
|
+
{
|
|
42
|
+
id: 'notifications',
|
|
43
|
+
title: '消息',
|
|
44
|
+
icon: 'mdi-bell-outline',
|
|
45
|
+
path: '/notifications',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'docs',
|
|
49
|
+
title: '文档',
|
|
50
|
+
icon: 'mdi-book-open-outline',
|
|
51
|
+
path: '/docs',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
const sampleAvatarMenuList = [
|
|
56
|
+
{
|
|
57
|
+
id: 'profile',
|
|
58
|
+
title: '个人资料',
|
|
59
|
+
path: '/profile',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'account',
|
|
63
|
+
title: '账号设置',
|
|
64
|
+
path: '/account',
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const sampleUserInfo = {
|
|
69
|
+
username: '张三',
|
|
70
|
+
userId: 'zhangsan',
|
|
71
|
+
roles: ['管理员', '编辑者'],
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default {
|
|
75
|
+
title: '基础组件/JhMenu - 导航菜单',
|
|
76
|
+
component: JhMenu,
|
|
77
|
+
tags: ['autodocs'],
|
|
78
|
+
argTypes: {
|
|
79
|
+
appTitle: {
|
|
80
|
+
control: 'text',
|
|
81
|
+
description: '应用标题',
|
|
82
|
+
},
|
|
83
|
+
showAvatar: {
|
|
84
|
+
control: 'boolean',
|
|
85
|
+
description: '是否显示用户头像和菜单',
|
|
86
|
+
},
|
|
87
|
+
temporary: {
|
|
88
|
+
control: 'boolean',
|
|
89
|
+
description: '移动端抽屉是否临时显示(点击外部关闭)',
|
|
90
|
+
},
|
|
91
|
+
hideDrawers: {
|
|
92
|
+
control: 'boolean',
|
|
93
|
+
description: '隐藏抽屉(用于Storybook预览时避免抽屉遮挡)',
|
|
94
|
+
},
|
|
95
|
+
activeMenuIndex: {
|
|
96
|
+
control: { type: 'number', min: -1, max: 10 },
|
|
97
|
+
description: '当前激活的菜单索引',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
parameters: {
|
|
101
|
+
docs: {
|
|
102
|
+
description: {
|
|
103
|
+
component: `
|
|
104
|
+
|
|
105
|
+
一个功能完整的导航菜单组件,支持:
|
|
106
|
+
- 响应式设计(PC端和移动端不同布局)
|
|
107
|
+
- 一级和二级菜单
|
|
108
|
+
- 用户信息和头像菜单
|
|
109
|
+
- 右侧工具菜单
|
|
110
|
+
- 移动端抽屉菜单
|
|
111
|
+
|
|
112
|
+
## 菜单数据结构
|
|
113
|
+
|
|
114
|
+
\`\`\`javascript
|
|
115
|
+
// 一级菜单
|
|
116
|
+
{
|
|
117
|
+
id: 'menu-id',
|
|
118
|
+
title: '菜单标题',
|
|
119
|
+
path: '/menu/path',
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 二级菜单
|
|
123
|
+
{
|
|
124
|
+
id: 'parent-menu',
|
|
125
|
+
title: '父菜单',
|
|
126
|
+
children: [
|
|
127
|
+
{ id: 'child-1', title: '子菜单1', path: '/path1' },
|
|
128
|
+
{ id: 'child-2', title: '子菜单2', path: '/path2' },
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
133
|
+
## 事件
|
|
134
|
+
|
|
135
|
+
- \`menu-click\`: 点击菜单时触发,参数为 (menuItem, menuIndex)
|
|
136
|
+
- \`logout\`: 点击登出时触发
|
|
137
|
+
`,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// 基础示例
|
|
144
|
+
export const 基础示例 = {
|
|
145
|
+
args: {
|
|
146
|
+
appTitle: 'JianghuJS Admin',
|
|
147
|
+
menuList: sampleMenuList,
|
|
148
|
+
rightMenuList: sampleRightMenuList,
|
|
149
|
+
avatarMenuList: sampleAvatarMenuList,
|
|
150
|
+
userInfo: sampleUserInfo,
|
|
151
|
+
showAvatar: true,
|
|
152
|
+
temporary: true,
|
|
153
|
+
hideDrawers: false,
|
|
154
|
+
activeMenuIndex: 0,
|
|
155
|
+
activeSecondMenuId: null,
|
|
156
|
+
},
|
|
157
|
+
render: (args) => ({
|
|
158
|
+
components: { JhMenu },
|
|
159
|
+
data() {
|
|
160
|
+
return { args };
|
|
161
|
+
},
|
|
162
|
+
template: `
|
|
163
|
+
<div>
|
|
164
|
+
<jh-menu
|
|
165
|
+
v-bind="args"
|
|
166
|
+
@menu-click="handleMenuClick"
|
|
167
|
+
@logout="handleLogout"
|
|
168
|
+
>
|
|
169
|
+
<template v-slot:title>{{ args.appTitle }}</template>
|
|
170
|
+
</jh-menu>
|
|
171
|
+
<v-main class="mt-15">
|
|
172
|
+
<v-container>
|
|
173
|
+
<h3>菜单组件演示</h3>
|
|
174
|
+
<p>点击菜单项查看效果</p>
|
|
175
|
+
<v-alert type="info" dense text>
|
|
176
|
+
<strong>提示:</strong>在小屏幕下,菜单会自动切换为移动端抽屉模式
|
|
177
|
+
</v-alert>
|
|
178
|
+
</v-container>
|
|
179
|
+
</v-main>
|
|
180
|
+
</div>
|
|
181
|
+
`,
|
|
182
|
+
methods: {
|
|
183
|
+
handleMenuClick(menu, index) {
|
|
184
|
+
console.log('Menu clicked:', menu, index);
|
|
185
|
+
if (index !== undefined) {
|
|
186
|
+
this.args.activeMenuIndex = index;
|
|
187
|
+
}
|
|
188
|
+
if (menu.id) {
|
|
189
|
+
this.args.activeSecondMenuId = menu.id;
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
handleLogout() {
|
|
193
|
+
console.log('Logout clicked');
|
|
194
|
+
alert('登出功能被触发');
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
}),
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// 活动菜单
|
|
201
|
+
export const 活动菜单 = {
|
|
202
|
+
args: {
|
|
203
|
+
...基础示例.args,
|
|
204
|
+
activeMenuIndex: 1,
|
|
205
|
+
activeSecondMenuId: 'user-list',
|
|
206
|
+
},
|
|
207
|
+
render: 基础示例.render,
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// 无用户头像
|
|
211
|
+
export const 无用户头像 = {
|
|
212
|
+
args: {
|
|
213
|
+
...基础示例.args,
|
|
214
|
+
showAvatar: false,
|
|
215
|
+
},
|
|
216
|
+
render: 基础示例.render,
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// 最小化菜单
|
|
220
|
+
export const 最小化菜单 = {
|
|
221
|
+
args: {
|
|
222
|
+
appTitle: 'Simple App',
|
|
223
|
+
menuList: [
|
|
224
|
+
{ id: 'home', title: '首页', path: '/' },
|
|
225
|
+
{ id: 'about', title: '关于', path: '/about' },
|
|
226
|
+
{ id: 'contact', title: '联系', path: '/contact' },
|
|
227
|
+
],
|
|
228
|
+
rightMenuList: [],
|
|
229
|
+
avatarMenuList: [],
|
|
230
|
+
userInfo: sampleUserInfo,
|
|
231
|
+
showAvatar: false,
|
|
232
|
+
hideDrawers: false,
|
|
233
|
+
},
|
|
234
|
+
render: 基础示例.render,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// 一级菜单
|
|
238
|
+
export const 一级菜单 = {
|
|
239
|
+
args: {
|
|
240
|
+
...基础示例.args,
|
|
241
|
+
menuList: [
|
|
242
|
+
{ id: 'dashboard', title: '仪表盘', path: '/dashboard' },
|
|
243
|
+
{ id: 'analytics', title: '数据分析', path: '/analytics' },
|
|
244
|
+
{ id: 'reports', title: '报表', path: '/reports' },
|
|
245
|
+
{ id: 'settings', title: '设置', path: '/settings' },
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
render: 基础示例.render,
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// 二级菜单
|
|
252
|
+
export const 二级菜单 = {
|
|
253
|
+
args: {
|
|
254
|
+
...基础示例.args,
|
|
255
|
+
menuList: [
|
|
256
|
+
{
|
|
257
|
+
id: 'system',
|
|
258
|
+
title: '系统管理',
|
|
259
|
+
children: [
|
|
260
|
+
{ id: 'users', title: '用户管理', path: '/system/users' },
|
|
261
|
+
{ id: 'roles', title: '角色管理', path: '/system/roles' },
|
|
262
|
+
{ id: 'logs', title: '日志管理', path: '/system/logs' },
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: 'content',
|
|
267
|
+
title: '内容管理',
|
|
268
|
+
children: [
|
|
269
|
+
{ id: 'posts', title: '文章', path: '/content/posts' },
|
|
270
|
+
{ id: 'pages', title: '页面', path: '/content/pages' },
|
|
271
|
+
{ id: 'media', title: '媒体', path: '/content/media' },
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
render: 基础示例.render,
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// 自定义标题
|
|
280
|
+
export const 自定义标题 = {
|
|
281
|
+
args: {
|
|
282
|
+
...基础示例.args,
|
|
283
|
+
},
|
|
284
|
+
render: (args) => ({
|
|
285
|
+
components: { JhMenu },
|
|
286
|
+
data() {
|
|
287
|
+
return { args };
|
|
288
|
+
},
|
|
289
|
+
template: `
|
|
290
|
+
<div>
|
|
291
|
+
<jh-menu
|
|
292
|
+
v-bind="args"
|
|
293
|
+
@menu-click="handleMenuClick"
|
|
294
|
+
@logout="handleLogout"
|
|
295
|
+
>
|
|
296
|
+
<template v-slot:title>
|
|
297
|
+
<v-icon color="success" class="mr-2">mdi-account-group</v-icon>
|
|
298
|
+
<span class="success--text">{{ args.appTitle }}</span>
|
|
299
|
+
</template>
|
|
300
|
+
<template v-slot:subtitle>
|
|
301
|
+
欢迎使用
|
|
302
|
+
</template>
|
|
303
|
+
</jh-menu>
|
|
304
|
+
<v-main class="mt-15">
|
|
305
|
+
<v-container>
|
|
306
|
+
<h3>自定义标题插槽演示</h3>
|
|
307
|
+
<p>标题区域可以通过插槽自定义内容</p>
|
|
308
|
+
</v-container>
|
|
309
|
+
</v-main>
|
|
310
|
+
</div>
|
|
311
|
+
`,
|
|
312
|
+
methods: {
|
|
313
|
+
handleMenuClick(menu, index) {
|
|
314
|
+
console.log('Menu clicked:', menu, index);
|
|
315
|
+
},
|
|
316
|
+
handleLogout() {
|
|
317
|
+
console.log('Logout clicked');
|
|
318
|
+
alert('登出功能被触发');
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
}),
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// 长菜单列表
|
|
325
|
+
export const 长菜单列表 = {
|
|
326
|
+
args: {
|
|
327
|
+
...基础示例.args,
|
|
328
|
+
menuList: [
|
|
329
|
+
{ id: 'menu1', title: '菜单1', path: '/menu1' },
|
|
330
|
+
{ id: 'menu2', title: '菜单2', path: '/menu2' },
|
|
331
|
+
{ id: 'menu3', title: '菜单3', path: '/menu3' },
|
|
332
|
+
{ id: 'menu4', title: '菜单4', path: '/menu4' },
|
|
333
|
+
{ id: 'menu5', title: '菜单5', path: '/menu5' },
|
|
334
|
+
{ id: 'menu6', title: '菜单6', path: '/menu6' },
|
|
335
|
+
{ id: 'menu7', title: '菜单7', path: '/menu7' },
|
|
336
|
+
{ id: 'menu8', title: '菜单8', path: '/menu8' },
|
|
337
|
+
{
|
|
338
|
+
id: 'menu9',
|
|
339
|
+
title: '菜单9',
|
|
340
|
+
children: [
|
|
341
|
+
{ id: 'submenu1', title: '子菜单1', path: '/menu9/sub1' },
|
|
342
|
+
{ id: 'submenu2', title: '子菜单2', path: '/menu9/sub2' },
|
|
343
|
+
],
|
|
344
|
+
},
|
|
345
|
+
{ id: 'menu10', title: '菜单10', path: '/menu10' },
|
|
346
|
+
],
|
|
347
|
+
},
|
|
348
|
+
render: 基础示例.render,
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
// 三级菜单
|
|
352
|
+
export const 三级菜单 = {
|
|
353
|
+
args: {
|
|
354
|
+
...基础示例.args,
|
|
355
|
+
menuList: [
|
|
356
|
+
{
|
|
357
|
+
id: 'system',
|
|
358
|
+
title: '系统管理',
|
|
359
|
+
children: [
|
|
360
|
+
{
|
|
361
|
+
id: 'users',
|
|
362
|
+
title: '用户管理',
|
|
363
|
+
children: [
|
|
364
|
+
{ id: 'user-list', title: '用户列表', path: '/system/users/list' },
|
|
365
|
+
{ id: 'user-add', title: '新增用户', path: '/system/users/add' },
|
|
366
|
+
],
|
|
367
|
+
},
|
|
368
|
+
{ id: 'roles', title: '角色管理', path: '/system/roles' },
|
|
369
|
+
],
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: 'content',
|
|
373
|
+
title: '内容管理',
|
|
374
|
+
children: [
|
|
375
|
+
{ id: 'posts', title: '文章', path: '/content/posts' },
|
|
376
|
+
{ id: 'pages', title: '页面', path: '/content/pages' },
|
|
377
|
+
],
|
|
378
|
+
},
|
|
379
|
+
],
|
|
380
|
+
activeMenuIndex: 0,
|
|
381
|
+
activeSecondMenuId: 'user-list',
|
|
382
|
+
},
|
|
383
|
+
render: 基础示例.render,
|
|
384
|
+
};
|