config.ts 1.9 KB

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