diff --git a/src/components/DiyEditor/components/mobile/MenuGrid/config.ts b/src/components/DiyEditor/components/mobile/MenuGrid/config.ts new file mode 100644 index 00000000..ccf09b2e --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuGrid/config.ts @@ -0,0 +1,78 @@ +import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util' +import { cloneDeep } from 'lodash-es' + +/** 宫格导航属性 */ +export interface MenuGridProperty { + // 列数 + column: number + // 导航菜单列表 + list: MenuGridItemProperty[] + // 组件样式 + style: ComponentStyle +} +/** 宫格导航项目属性 */ +export interface MenuGridItemProperty { + // 图标链接 + iconUrl: string + // 标题 + title: string + // 标题颜色 + titleColor: string + // 副标题 + subtitle: string + // 副标题颜色 + subtitleColor: string + // 链接 + url: string + // 角标 + badge: { + // 是否显示 + show: boolean + // 角标文字 + text: string + // 角标文字颜色 + textColor: string + // 角标背景颜色 + bgColor: string + } +} + +export const EMPTY_MENU_GRID_ITEM_PROPERTY = { + title: '标题', + titleColor: '#333', + subtitle: '副标题', + subtitleColor: '#bbb', + badge: { + show: false, + textColor: '#fff', + bgColor: '#FF6000' + } +} as MenuGridItemProperty + +// 定义组件 +export const component = { + id: 'MenuGrid', + name: '宫格导航', + icon: 'fa-solid:list', + property: { + column: 3, + list: [cloneDeep(EMPTY_MENU_GRID_ITEM_PROPERTY)], + style: { + bgType: 'color', + bgColor: '#fff', + marginBottom: 8, + marginLeft: 8, + marginRight: 8, + padding: 8, + paddingTop: 8, + paddingRight: 8, + paddingBottom: 8, + paddingLeft: 8, + borderRadius: 8, + borderTopLeftRadius: 8, + borderTopRightRadius: 8, + borderBottomRightRadius: 8, + borderBottomLeftRadius: 8 + } as ComponentStyle + } +} as DiyComponent diff --git a/src/components/DiyEditor/components/mobile/MenuGrid/index.vue b/src/components/DiyEditor/components/mobile/MenuGrid/index.vue new file mode 100644 index 00000000..1c5ef1dc --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuGrid/index.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/src/components/DiyEditor/components/mobile/MenuGrid/property.vue b/src/components/DiyEditor/components/mobile/MenuGrid/property.vue new file mode 100644 index 00000000..e09dd318 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/MenuGrid/property.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/src/components/DiyEditor/components/mobile/MenuList/config.ts b/src/components/DiyEditor/components/mobile/MenuList/config.ts index f06adfae..c42674f3 100644 --- a/src/components/DiyEditor/components/mobile/MenuList/config.ts +++ b/src/components/DiyEditor/components/mobile/MenuList/config.ts @@ -1,4 +1,5 @@ import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util' +import { cloneDeep } from 'lodash-es' /** 列表导航属性 */ export interface MenuListProperty { @@ -23,13 +24,20 @@ export interface MenuListItemProperty { url: string } +export const EMPTY_MENU_LIST_ITEM_PROPERTY = { + title: '标题', + titleColor: '#333', + subtitle: '副标题', + subtitleColor: '#bbb' +} + // 定义组件 export const component = { id: 'MenuList', name: '列表导航', icon: 'fa-solid:list', property: { - list: [], + list: [cloneDeep(EMPTY_MENU_LIST_ITEM_PROPERTY)], style: { bgType: 'color', bgColor: '#fff', diff --git a/src/components/DiyEditor/components/mobile/MenuList/property.vue b/src/components/DiyEditor/components/mobile/MenuList/property.vue index 51652b6e..270ca261 100644 --- a/src/components/DiyEditor/components/mobile/MenuList/property.vue +++ b/src/components/DiyEditor/components/mobile/MenuList/property.vue @@ -49,7 +49,11 @@