You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

131 line
4.4 KiB

  1. import { defineMixin } from '../../libs/vue'
  2. import SwiperDefaultProps from './swiper'
  3. import { registerComponentProps } from '../../libs/config/props.js'
  4. const defProps = registerComponentProps(SwiperDefaultProps)
  5. export const props = defineMixin({
  6. props: {
  7. // 列表数组,元素可为字符串,如为对象可通过keyName指定目标属性名
  8. list: {
  9. type: Array,
  10. default: () => defProps.swiper.list
  11. },
  12. // 是否显示面板指示器
  13. indicator: {
  14. type: Boolean,
  15. default: () => defProps.swiper.indicator
  16. },
  17. // 指示器非激活颜色
  18. indicatorActiveColor: {
  19. type: String,
  20. default: () => defProps.swiper.indicatorActiveColor
  21. },
  22. // 指示器的激活颜色
  23. indicatorInactiveColor: {
  24. type: String,
  25. default: () => defProps.swiper.indicatorInactiveColor
  26. },
  27. // 指示器样式,可通过bottom,left,right进行定位
  28. indicatorStyle: {
  29. type: [String, Object],
  30. default: () => defProps.swiper.indicatorStyle
  31. },
  32. // 指示器模式,line-线型,dot-点型
  33. indicatorMode: {
  34. type: String,
  35. default: () => defProps.swiper.indicatorMode
  36. },
  37. // 是否自动切换
  38. autoplay: {
  39. type: Boolean,
  40. default: () => defProps.swiper.autoplay
  41. },
  42. // 当前所在滑块的 index
  43. current: {
  44. type: [String, Number],
  45. default: () => defProps.swiper.current
  46. },
  47. // 当前所在滑块的 item-id ,不能与 current 被同时指定
  48. currentItemId: {
  49. type: String,
  50. default: () => defProps.swiper.currentItemId
  51. },
  52. // 滑块自动切换时间间隔
  53. interval: {
  54. type: [String, Number],
  55. default: () => defProps.swiper.interval
  56. },
  57. // 滑块切换过程所需时间
  58. duration: {
  59. type: [String, Number],
  60. default: () => defProps.swiper.duration
  61. },
  62. // 播放到末尾后是否重新回到开头
  63. circular: {
  64. type: Boolean,
  65. default: () => defProps.swiper.circular
  66. },
  67. // 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持
  68. previousMargin: {
  69. type: [String, Number],
  70. default: () => defProps.swiper.previousMargin
  71. },
  72. // 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持
  73. nextMargin: {
  74. type: [String, Number],
  75. default: () => defProps.swiper.nextMargin
  76. },
  77. // 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持
  78. acceleration: {
  79. type: Boolean,
  80. default: () => defProps.swiper.acceleration
  81. },
  82. // 同时显示的滑块数量,nvue、支付宝小程序不支持
  83. displayMultipleItems: {
  84. type: Number,
  85. default: () => defProps.swiper.displayMultipleItems
  86. },
  87. // 指定swiper切换缓动动画类型,有效值:default、linear、easeInCubic、easeOutCubic、easeInOutCubic
  88. // 只对微信小程序有效
  89. easingFunction: {
  90. type: String,
  91. default: () => defProps.swiper.easingFunction
  92. },
  93. // list数组中指定对象的目标属性名
  94. keyName: {
  95. type: String,
  96. default: () => defProps.swiper.keyName
  97. },
  98. // 图片的裁剪模式
  99. imgMode: {
  100. type: String,
  101. default: () => defProps.swiper.imgMode
  102. },
  103. // 组件高度
  104. height: {
  105. type: [String, Number],
  106. default: () => defProps.swiper.height
  107. },
  108. // 背景颜色
  109. bgColor: {
  110. type: String,
  111. default: () => defProps.swiper.bgColor
  112. },
  113. // 组件圆角,数值或带单位的字符串
  114. radius: {
  115. type: [String, Number],
  116. default: () => defProps.swiper.radius
  117. },
  118. // 是否加载中
  119. loading: {
  120. type: Boolean,
  121. default: () => defProps.swiper.loading
  122. },
  123. // 是否显示标题,要求数组对象中有title属性
  124. showTitle: {
  125. type: Boolean,
  126. default: () => defProps.swiper.showTitle
  127. }
  128. }
  129. })