提交 | 用户 | 时间
|
314507
|
1 |
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util' |
H |
2 |
import { cloneDeep } from 'lodash-es' |
|
3 |
|
|
4 |
/** 宫格导航属性 */ |
|
5 |
export interface MenuGridProperty { |
|
6 |
// 列数 |
|
7 |
column: number |
|
8 |
// 导航菜单列表 |
|
9 |
list: MenuGridItemProperty[] |
|
10 |
// 组件样式 |
|
11 |
style: ComponentStyle |
|
12 |
} |
|
13 |
|
|
14 |
/** 宫格导航项目属性 */ |
|
15 |
export interface MenuGridItemProperty { |
|
16 |
// 图标链接 |
|
17 |
iconUrl: string |
|
18 |
// 标题 |
|
19 |
title: string |
|
20 |
// 标题颜色 |
|
21 |
titleColor: string |
|
22 |
// 副标题 |
|
23 |
subtitle: string |
|
24 |
// 副标题颜色 |
|
25 |
subtitleColor: string |
|
26 |
// 链接 |
|
27 |
url: string |
|
28 |
// 角标 |
|
29 |
badge: { |
|
30 |
// 是否显示 |
|
31 |
show: boolean |
|
32 |
// 角标文字 |
|
33 |
text: string |
|
34 |
// 角标文字颜色 |
|
35 |
textColor: string |
|
36 |
// 角标背景颜色 |
|
37 |
bgColor: string |
|
38 |
} |
|
39 |
} |
|
40 |
|
|
41 |
export const EMPTY_MENU_GRID_ITEM_PROPERTY = { |
|
42 |
title: '标题', |
|
43 |
titleColor: '#333', |
|
44 |
subtitle: '副标题', |
|
45 |
subtitleColor: '#bbb', |
|
46 |
badge: { |
|
47 |
show: false, |
|
48 |
textColor: '#fff', |
|
49 |
bgColor: '#FF6000' |
|
50 |
} |
|
51 |
} as MenuGridItemProperty |
|
52 |
|
|
53 |
// 定义组件 |
|
54 |
export const component = { |
|
55 |
id: 'MenuGrid', |
|
56 |
name: '宫格导航', |
|
57 |
icon: 'bi:grid-3x3-gap', |
|
58 |
property: { |
|
59 |
column: 3, |
|
60 |
list: [cloneDeep(EMPTY_MENU_GRID_ITEM_PROPERTY)], |
|
61 |
style: { |
|
62 |
bgType: 'color', |
|
63 |
bgColor: '#fff', |
|
64 |
marginBottom: 8, |
|
65 |
marginLeft: 8, |
|
66 |
marginRight: 8, |
|
67 |
padding: 8, |
|
68 |
paddingTop: 8, |
|
69 |
paddingRight: 8, |
|
70 |
paddingBottom: 8, |
|
71 |
paddingLeft: 8, |
|
72 |
borderRadius: 8, |
|
73 |
borderTopLeftRadius: 8, |
|
74 |
borderTopRightRadius: 8, |
|
75 |
borderBottomRightRadius: 8, |
|
76 |
borderBottomLeftRadius: 8 |
|
77 |
} as ComponentStyle |
|
78 |
} |
|
79 |
} as DiyComponent<MenuGridProperty> |