component.scheme.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. export const propsScheme = {
  2. src: {
  3. type: String,
  4. intro: '图片源地址,同原生属性一致'
  5. },
  6. fit: {
  7. type: String,
  8. intro: '确定图片如何适应容器框,同原生',
  9. options: ['fill', 'contain', 'cover', 'none', 'scale-down'],
  10. validate: true,
  11. attr: true
  12. },
  13. hideOnClickModal: {
  14. type: Boolean,
  15. intro: '当开启 preview 功能时,是否可以通过点击遮罩层关闭 preview',
  16. default: false,
  17. attr: true
  18. },
  19. loading: {
  20. type: String,
  21. intro: '浏览器加载图像的策略,和 浏览器原生能力一致',
  22. options: ['eager', 'lazy'],
  23. validate: true,
  24. attr: true
  25. },
  26. lazy: {
  27. type: Boolean,
  28. intro: '是否使用懒加载',
  29. default: false,
  30. attr: true
  31. },
  32. scrollContainer: {
  33. type: [String, HTMLElement],
  34. intro: '开启懒加载功能后,监听 scroll 事件的容器',
  35. default: '最近一个 overflow 值为 auto 或 scroll 的父元素',
  36. attr: true
  37. },
  38. alt: {
  39. type: String,
  40. intro: '原生属性 alt',
  41. attr: true
  42. },
  43. referrerPolicy: {
  44. type: String,
  45. intro: '原生属性 referrerPolicy',
  46. attr: true
  47. },
  48. previewSrcList: {
  49. type: Array,
  50. intro: '开启图片预览功能',
  51. attr: true
  52. },
  53. zIndex: {
  54. type: Number,
  55. intro: '设置图片预览的 z-index',
  56. attr: true
  57. },
  58. initialIndex: {
  59. type: Number,
  60. intro: '初始预览图像索引,小于 url-list 的长度',
  61. default: 0,
  62. attr: true
  63. },
  64. closeOnPressEscape: {
  65. type: Boolean,
  66. intro: '是否可以通过按下 ESC 关闭 Image Viewer',
  67. default: true,
  68. attr: true
  69. },
  70. previewTeleported: {
  71. type: Boolean,
  72. intro: 'image-viewer 是否插入至 body 元素上。 嵌套的父元素属性会发生修改时应该将此属性设置为 true',
  73. default: false,
  74. attr: true
  75. }
  76. }
  77. export const eventsScheme = {
  78. load: {
  79. intro: '图片加载成功触发',
  80. cbVar: 'e: Event'
  81. },
  82. error: {
  83. intro: '图片加载失败触发',
  84. cbVar: 'e: Error'
  85. },
  86. switch: {
  87. intro: '切换图像时触发。',
  88. cbVar: 'index: number'
  89. },
  90. close: {
  91. intro: '当点击 X 按钮或者在hide-on-click-modal为 true 时点击遮罩层时触发'
  92. }
  93. }
  94. export const componentScheme = {
  95. propsScheme,
  96. eventsScheme
  97. }