gaoluyang
2026-06-24 bfdc0e0e6d5e47aa501f9b6fadd143d9c97cf00a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import type { Rect } from '../../../../magic-cube-editor/util';
import type { DiyComponent } from '../../../util';
 
/** 顶部导航栏属性 */
export interface NavigationBarProperty {
  bgType: 'color' | 'img'; // 背景类型
  bgColor: string; // 背景颜色
  bgImg: string; // 图片链接
  styleType: 'inner' | 'normal'; // 样式类型:默认 | 沉浸式
  alwaysShow: boolean; // 常驻显示
  mpCells: NavigationBarCellProperty[]; // 小程序单元格列表
  otherCells: NavigationBarCellProperty[]; // 其它平台单元格列表
  _local: {
    previewMp: boolean; // 预览顶部导航(小程序)
    previewOther: boolean; // 预览顶部导航(非小程序)
  }; // 本地变量
}
 
/** 顶部导航栏 - 单元格 属性 */
export interface NavigationBarCellProperty extends Rect {
  type: 'image' | 'search' | 'text'; // 类型:文字 | 图片 | 搜索框
  text: string; // 文字内容
  textColor: string; // 文字颜色
  imgUrl: string; // 图片地址
  url: string; // 图片链接
  backgroundColor: string; // 搜索框:框体颜色
  placeholder: string; // 搜索框:提示文字
  placeholderPosition: string; // 搜索框:提示文字位置
  showScan: boolean; // 搜索框:是否显示扫一扫
  borderRadius: number; // 搜索框:边框圆角半径
}
 
/** 定义组件 */
export const component = {
  id: 'NavigationBar',
  name: '顶部导航栏',
  icon: 'tabler:layout-navbar',
  property: {
    bgType: 'color',
    bgColor: '#fff',
    bgImg: '',
    styleType: 'normal',
    alwaysShow: true,
    mpCells: [
      {
        type: 'text',
        textColor: '#111111',
      },
    ],
    otherCells: [
      {
        type: 'text',
        textColor: '#111111',
      },
    ],
    _local: {
      previewMp: true,
      previewOther: false,
    },
  },
} as DiyComponent<NavigationBarProperty>;