diff --git a/src/assets/imgs/diy/app-nav-bar-mp.png b/src/assets/imgs/diy/app-nav-bar-mp.png new file mode 100644 index 00000000..c982804c Binary files /dev/null and b/src/assets/imgs/diy/app-nav-bar-mp.png differ diff --git a/src/components/DiyEditor/components/mobile/NavigationBar/components/CellProperty.vue b/src/components/DiyEditor/components/mobile/NavigationBar/components/CellProperty.vue new file mode 100644 index 00000000..edc85f1a --- /dev/null +++ b/src/components/DiyEditor/components/mobile/NavigationBar/components/CellProperty.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/src/components/DiyEditor/components/mobile/NavigationBar/config.ts b/src/components/DiyEditor/components/mobile/NavigationBar/config.ts index f722d525..36612a3f 100644 --- a/src/components/DiyEditor/components/mobile/NavigationBar/config.ts +++ b/src/components/DiyEditor/components/mobile/NavigationBar/config.ts @@ -2,22 +2,53 @@ import { DiyComponent } from '@/components/DiyEditor/util' /** 顶部导航栏属性 */ export interface NavigationBarProperty { - // 页面标题 - title: string - // 页面描述 - description: string - // 顶部导航高度 - navBarHeight: number - // 页面背景颜色 - backgroundColor: string - // 页面背景图片 - backgroundImage: string + // 背景类型 + bgType: 'color' | 'img' + // 背景颜色 + bgColor: string + // 图片链接 + bgImg: string // 样式类型:默认 | 沉浸式 - styleType: 'default' | 'immersion' + styleType: 'normal' | 'inner' // 常驻显示 alwaysShow: boolean - // 是否显示返回按钮 - showGoBack: boolean + // 小程序单元格列表 + mpCells: NavigationBarCellProperty[] + // 其它平台单元格列表 + otherCells: NavigationBarCellProperty[] + // 本地变量 + _local: { + // 预览顶部导航(小程序) + previewMp: boolean + // 预览顶部导航(非小程序) + previewOther: boolean + } +} + +/** 顶部导航栏 - 单元格 属性 */ +export interface NavigationBarCellProperty { + // 类型:文字 | 图片 | 搜索框 + type: 'text' | 'image' | 'search' + // 宽度 + width: number + // 高度 + height: number + // 顶部位置 + top: number + // 左侧位置 + left: number + // 文字内容 + text: string + // 文字颜色 + textColor: string + // 图片地址 + imgUrl: string + // 图片链接 + url: string + // 搜索框:提示文字 + placeholder: string + // 搜索框:边框圆角半径 + borderRadius: number } // 定义组件 @@ -26,13 +57,26 @@ export const component = { name: '顶部导航栏', icon: 'tabler:layout-navbar', property: { - title: '页面标题', - description: '', - navBarHeight: 35, - backgroundColor: '#fff', - backgroundImage: '', - styleType: 'default', + bgType: 'color', + bgColor: '#fff', + bgImg: '', + styleType: 'normal', alwaysShow: true, - showGoBack: true + mpCells: [ + { + type: 'text', + textColor: '#111111' + } + ], + otherCells: [ + { + type: 'text', + textColor: '#111111' + } + ], + _local: { + previewMp: true, + previewOther: false + } } } as DiyComponent diff --git a/src/components/DiyEditor/components/mobile/NavigationBar/index.vue b/src/components/DiyEditor/components/mobile/NavigationBar/index.vue index f5cfff8c..c684aee7 100644 --- a/src/components/DiyEditor/components/mobile/NavigationBar/index.vue +++ b/src/components/DiyEditor/components/mobile/NavigationBar/index.vue @@ -1,45 +1,73 @@ diff --git a/src/components/MagicCubeEditor/index.vue b/src/components/MagicCubeEditor/index.vue index 26ea179d..9b9a43cc 100644 --- a/src/components/MagicCubeEditor/index.vue +++ b/src/components/MagicCubeEditor/index.vue @@ -189,7 +189,7 @@ const emit = defineEmits(['update:modelValue', 'hotAreaSelected']) const emitUpdateModelValue = () => emit('update:modelValue', hotAreas) // 热区选中 -const selectedHotAreaIndex = ref(-1) +const selectedHotAreaIndex = ref(0) const handleHotAreaSelected = (hotArea: Rect, index: number) => { selectedHotAreaIndex.value = index emit('hotAreaSelected', hotArea, index)