鲁班向自定义组件 默认注入了一些属性,便于开发

editorMode 编辑器当前模式

  • preview: 预览模式
  • edit: 编辑模式
  1. props: {
  2. editorMode: {
  3. type: String,
  4. default: 'edit'
  5. },
  6. }
  1. /**
  2. * #!zh: 编辑器当前模式:
  3. * preview: 预览模式
  4. * edit: 编辑模式
  5. *
  6. * 通常用在轮播图、单选、多选、提交按钮、视频
  7. * 因为他们在编辑模式和预览模式下有不同的表现
  8. *
  9. * 举例:
  10. * ================================================================================================================================
  11. * | 组件名称 | 编辑模式表现 | 预览模式表现 |
  12. * ================================================================================================================================
  13. * | 轮播图 | 正在编辑的图片 | 轮播图 |
  14. * --------------------------------------------------------------------------------------------------------------------------------
  15. * | 提交按钮 | 仅可点击, 但不会提交表单 | 可点击, 且可以提交表单 |
  16. * --------------------------------------------------------------------------------------------------------------------------------
  17. * | 视频 | 视频占位 icon | 可播放的视频 |
  18. * --------------------------------------------------------------------------------------------------------------------------------
  19. *
  20. *
  21. *
  22. * #!en: current mode for editor
  23. * preview: preview mode
  24. * edit: edit mode
  25. *
  26. * commonly used for carousel, checkbox, radio, form submit button、video etc...
  27. * Because they have different behaviour in edit mode and preview mode.
  28. *
  29. * Examples:
  30. * ================================================================================================================================
  31. * | Component | Edit Mode Behaviour | Preview Mode Behaviour |
  32. * ================================================================================================================================
  33. * | carousel | editing image | carousel |
  34. * --------------------------------------------------------------------------------------------------------------------------------
  35. * | form submit button | only clickable, but will not submit the form | clickable, can submit the form |
  36. * --------------------------------------------------------------------------------------------------------------------------------
  37. * | video | video placeholder icon | playable video |
  38. * --------------------------------------------------------------------------------------------------------------------------------
  39. *
  40. */