@kengic/uni 0.3.2-beta.4 → 0.3.2-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/kengic-uni.js +2 -1527
  2. package/dist/src/index.d.ts +0 -1
  3. package/dist/uni-ui/index.ts +5 -0
  4. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  5. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  6. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  7. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  8. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  9. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  10. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  11. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  12. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  13. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  14. package/dist/uni-ui/uni-calendar/util.js +360 -0
  15. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  16. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  17. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  18. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  19. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  20. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  21. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  22. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  23. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  24. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  25. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  26. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  27. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  28. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  29. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  30. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  31. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  32. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  33. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  34. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  35. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  36. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  37. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  38. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  39. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  40. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  41. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  42. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  43. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  44. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  45. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  46. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  47. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  48. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  49. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  50. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  51. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  52. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  53. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  54. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  55. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  56. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  57. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  58. package/dist/uni-ui/uni-forms/utils.js +293 -0
  59. package/dist/uni-ui/uni-forms/validate.js +486 -0
  60. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  61. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  62. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  63. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  64. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  65. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  66. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  67. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  68. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  69. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  70. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  71. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  72. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  73. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  74. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  75. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  76. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  77. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  78. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  79. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  80. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  81. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  82. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  83. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  84. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  85. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  86. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  87. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  88. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  89. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  90. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  91. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  92. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  93. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  94. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  95. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  96. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  97. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  98. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  99. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  100. package/dist/uni-ui/uni-popup/i18n/index.js +8 -0
  101. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  102. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  103. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  104. package/dist/uni-ui/uni-popup/popup.js +26 -0
  105. package/dist/uni-ui/uni-popup/uni-popup.vue +473 -0
  106. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  107. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  108. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  109. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  110. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  111. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  112. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  113. package/dist/uni-ui/uni-scss/index.scss +1 -0
  114. package/dist/uni-ui/uni-scss/package.json +82 -0
  115. package/dist/uni-ui/uni-scss/readme.md +4 -0
  116. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  117. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  118. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  119. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  120. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  121. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  122. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  123. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  124. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  125. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  126. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  127. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  128. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  129. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  130. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  131. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  132. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  133. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  134. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  135. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  136. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  137. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  138. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  139. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  140. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  141. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  142. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  143. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  144. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  145. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  146. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  147. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  148. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  149. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  150. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  151. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  152. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  153. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  154. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  155. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  156. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  157. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  158. package/package.json +1 -1
  159. package/dist/index.css +0 -1
  160. package/dist/src/components/index.d.ts +0 -5
  161. package/dist/src/components/uni-ui/uni-badge/uni-badge.vue.d.ts +0 -108
  162. package/dist/src/components/uni-ui/uni-breadcrumb/uni-breadcrumb.vue.d.ts +0 -23
  163. package/dist/src/components/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue.d.ts +0 -30
  164. package/dist/src/components/uni-ui/uni-calendar/calendar.d.ts +0 -67
  165. package/dist/src/components/uni-ui/uni-calendar/i18n/index.d.ts +0 -39
  166. package/dist/src/components/uni-ui/uni-calendar/uni-calendar-item.vue.d.ts +0 -47
  167. package/dist/src/components/uni-ui/uni-calendar/uni-calendar.vue.d.ts +0 -166
  168. package/dist/src/components/uni-ui/uni-calendar/util.d.ts +0 -211
  169. package/dist/src/components/uni-ui/uni-card/uni-card.vue.d.ts +0 -117
  170. package/dist/src/components/uni-ui/uni-col/uni-col.vue.d.ts +0 -70
  171. package/dist/src/components/uni-ui/uni-collapse/uni-collapse.vue.d.ts +0 -45
  172. package/dist/src/components/uni-ui/uni-collapse-item/uni-collapse-item.vue.d.ts +0 -102
  173. package/dist/src/components/uni-ui/uni-combox/uni-combox.vue.d.ts +0 -95
  174. package/dist/src/components/uni-ui/uni-countdown/i18n/index.d.ts +0 -21
  175. package/dist/src/components/uni-ui/uni-countdown/uni-countdown.vue.d.ts +0 -158
  176. package/dist/src/components/uni-ui/uni-data-checkbox/uni-data-checkbox.vue.d.ts +0 -192
  177. package/dist/src/components/uni-ui/uni-data-picker/uni-data-picker.vue.d.ts +0 -244
  178. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-picker.d.ts +0 -178
  179. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-pickerview.vue.d.ts +0 -169
  180. package/dist/src/components/uni-ui/uni-data-select/uni-data-select.vue.d.ts +0 -125
  181. package/dist/src/components/uni-ui/uni-dateformat/date-format.d.ts +0 -6
  182. package/dist/src/components/uni-ui/uni-dateformat/uni-dateformat.vue.d.ts +0 -57
  183. package/dist/src/components/uni-ui/uni-datetime-picker/calendar-item.vue.d.ts +0 -44
  184. package/dist/src/components/uni-ui/uni-datetime-picker/calendar.vue.d.ts +0 -253
  185. package/dist/src/components/uni-ui/uni-datetime-picker/i18n/index.d.ts +0 -69
  186. package/dist/src/components/uni-ui/uni-datetime-picker/time-picker.vue.d.ts +0 -225
  187. package/dist/src/components/uni-ui/uni-datetime-picker/uni-datetime-picker.vue.d.ts +0 -236
  188. package/dist/src/components/uni-ui/uni-datetime-picker/util.d.ts +0 -171
  189. package/dist/src/components/uni-ui/uni-drawer/keypress.d.ts +0 -13
  190. package/dist/src/components/uni-ui/uni-drawer/uni-drawer.vue.d.ts +0 -78
  191. package/dist/src/components/uni-ui/uni-easyinput/uni-easyinput.vue.d.ts +0 -269
  192. package/dist/src/components/uni-ui/uni-fab/uni-fab.vue.d.ts +0 -109
  193. package/dist/src/components/uni-ui/uni-fav/i18n/index.d.ts +0 -15
  194. package/dist/src/components/uni-ui/uni-fav/uni-fav.vue.d.ts +0 -99
  195. package/dist/src/components/uni-ui/uni-file-picker/choose-and-upload-file.d.ts +0 -4
  196. package/dist/src/components/uni-ui/uni-file-picker/uni-file-picker.vue.d.ts +0 -254
  197. package/dist/src/components/uni-ui/uni-file-picker/upload-file.vue.d.ts +0 -81
  198. package/dist/src/components/uni-ui/uni-file-picker/upload-image.vue.d.ts +0 -90
  199. package/dist/src/components/uni-ui/uni-file-picker/utils.d.ts +0 -22
  200. package/dist/src/components/uni-ui/uni-forms/uni-forms.vue.d.ts +0 -160
  201. package/dist/src/components/uni-ui/uni-forms/utils.d.ts +0 -20
  202. package/dist/src/components/uni-ui/uni-forms/validate.d.ts +0 -42
  203. package/dist/src/components/uni-ui/uni-forms-item/uni-forms-item.vue.d.ts +0 -127
  204. package/dist/src/components/uni-ui/uni-goods-nav/i18n/index.d.ts +0 -21
  205. package/dist/src/components/uni-ui/uni-goods-nav/uni-goods-nav.vue.d.ts +0 -61
  206. package/dist/src/components/uni-ui/uni-grid/uni-grid.vue.d.ts +0 -59
  207. package/dist/src/components/uni-ui/uni-grid-item/uni-grid-item.vue.d.ts +0 -26
  208. package/dist/src/components/uni-ui/uni-group/uni-group.vue.d.ts +0 -52
  209. package/dist/src/components/uni-ui/uni-icons/icons.d.ts +0 -15
  210. package/dist/src/components/uni-ui/uni-icons/uni-icons.vue.d.ts +0 -56
  211. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list-item.vue.d.ts +0 -45
  212. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list.vue.d.ts +0 -49
  213. package/dist/src/components/uni-ui/uni-link/uni-link.vue.d.ts +0 -75
  214. package/dist/src/components/uni-ui/uni-list/uni-list.vue.d.ts +0 -53
  215. package/dist/src/components/uni-ui/uni-list/uni-refresh.vue.d.ts +0 -22
  216. package/dist/src/components/uni-ui/uni-list-ad/uni-list-ad.vue.d.ts +0 -25
  217. package/dist/src/components/uni-ui/uni-list-chat/uni-list-chat.vue.d.ts +0 -123
  218. package/dist/src/components/uni-ui/uni-list-item/uni-list-item.vue.d.ts +0 -248
  219. package/dist/src/components/uni-ui/uni-load-more/i18n/index.d.ts +0 -18
  220. package/dist/src/components/uni-ui/uni-load-more/uni-load-more.vue.d.ts +0 -89
  221. package/dist/src/components/uni-ui/uni-nav-bar/uni-nav-bar.vue.d.ts +0 -163
  222. package/dist/src/components/uni-ui/uni-nav-bar/uni-status-bar.vue.d.ts +0 -4
  223. package/dist/src/components/uni-ui/uni-notice-bar/uni-notice-bar.vue.d.ts +0 -138
  224. package/dist/src/components/uni-ui/uni-number-box/uni-number-box.vue.d.ts +0 -90
  225. package/dist/src/components/uni-ui/uni-pagination/i18n/index.d.ts +0 -28
  226. package/dist/src/components/uni-ui/uni-pagination/uni-pagination.vue.d.ts +0 -127
  227. package/dist/src/components/uni-ui/uni-popup/i18n/index.d.ts +0 -24
  228. package/dist/src/components/uni-ui/uni-popup/keypress.d.ts +0 -13
  229. package/dist/src/components/uni-ui/uni-popup/popup.d.ts +0 -11
  230. package/dist/src/components/uni-ui/uni-popup/uni-popup.vue.d.ts +0 -136
  231. package/dist/src/components/uni-ui/uni-popup-dialog/uni-popup-dialog.vue.d.ts +0 -123
  232. package/dist/src/components/uni-ui/uni-popup-message/uni-popup-message.vue.d.ts +0 -67
  233. package/dist/src/components/uni-ui/uni-popup-share/uni-popup-share.vue.d.ts +0 -49
  234. package/dist/src/components/uni-ui/uni-rate/uni-rate.vue.d.ts +0 -154
  235. package/dist/src/components/uni-ui/uni-row/uni-row.vue.d.ts +0 -41
  236. package/dist/src/components/uni-ui/uni-search-bar/i18n/index.d.ts +0 -15
  237. package/dist/src/components/uni-ui/uni-search-bar/uni-search-bar.vue.d.ts +0 -126
  238. package/dist/src/components/uni-ui/uni-section/uni-section.vue.d.ts +0 -85
  239. package/dist/src/components/uni-ui/uni-segmented-control/uni-segmented-control.vue.d.ts +0 -47
  240. package/dist/src/components/uni-ui/uni-steps/uni-steps.vue.d.ts +0 -59
  241. package/dist/src/components/uni-ui/uni-swipe-action/uni-swipe-action.vue.d.ts +0 -6
  242. package/dist/src/components/uni-ui/uni-swiper-dot/uni-swiper-dot.vue.d.ts +0 -65
  243. package/dist/src/components/uni-ui/uni-table/uni-table.vue.d.ts +0 -99
  244. package/dist/src/components/uni-ui/uni-tag/uni-tag.vue.d.ts +0 -84
  245. package/dist/src/components/uni-ui/uni-tbody/uni-tbody.vue.d.ts +0 -2
  246. package/dist/src/components/uni-ui/uni-td/uni-td.vue.d.ts +0 -48
  247. package/dist/src/components/uni-ui/uni-th/filter-dropdown.vue.d.ts +0 -99
  248. package/dist/src/components/uni-ui/uni-th/uni-th.vue.d.ts +0 -97
  249. package/dist/src/components/uni-ui/uni-thead/uni-thead.vue.d.ts +0 -15
  250. package/dist/src/components/uni-ui/uni-title/uni-title.vue.d.ts +0 -54
  251. package/dist/src/components/uni-ui/uni-tooltip/uni-tooltip.vue.d.ts +0 -23
  252. package/dist/src/components/uni-ui/uni-tr/table-checkbox.vue.d.ts +0 -58
  253. package/dist/src/components/uni-ui/uni-tr/uni-tr.vue.d.ts +0 -39
  254. package/dist/src/components/uni-ui/uni-transition/createAnimation.d.ts +0 -16
  255. package/dist/src/components/uni-ui/uni-transition/uni-transition.vue.d.ts +0 -240
@@ -0,0 +1,341 @@
1
+ var MIN_DISTANCE = 10;
2
+
3
+ /**
4
+ * 判断当前是否为H5、app-vue
5
+ */
6
+ var IS_HTML5 = false
7
+ if (typeof window === 'object') IS_HTML5 = true
8
+
9
+ /**
10
+ * 监听页面内值的变化,主要用于动态开关swipe-action
11
+ * @param {Object} newValue
12
+ * @param {Object} oldValue
13
+ * @param {Object} ownerInstance
14
+ * @param {Object} instance
15
+ */
16
+ function showWatch(newVal, oldVal, ownerInstance, instance) {
17
+ var state = instance.getState()
18
+ getDom(instance, ownerInstance)
19
+ if (newVal && newVal !== 'none') {
20
+ openState(newVal, instance, ownerInstance)
21
+ return
22
+ }
23
+
24
+ if (state.left) {
25
+ openState('none', instance, ownerInstance)
26
+ }
27
+ resetTouchStatus(instance)
28
+ }
29
+
30
+ /**
31
+ * 开始触摸操作
32
+ * @param {Object} e
33
+ * @param {Object} ins
34
+ */
35
+ function touchstart(e, ownerInstance) {
36
+ var instance = e.instance;
37
+ var disabled = instance.getDataset().disabled
38
+ var state = instance.getState();
39
+ getDom(instance, ownerInstance)
40
+ // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
41
+ disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
42
+ if (disabled) return
43
+ // 开始触摸时移除动画类
44
+ instance.requestAnimationFrame(function() {
45
+ instance.removeClass('ani');
46
+ ownerInstance.callMethod('closeSwipe');
47
+ })
48
+
49
+ // 记录上次的位置
50
+ state.x = state.left || 0
51
+ // 计算滑动开始位置
52
+ stopTouchStart(e, ownerInstance)
53
+ }
54
+
55
+ /**
56
+ * 开始滑动操作
57
+ * @param {Object} e
58
+ * @param {Object} ownerInstance
59
+ */
60
+ function touchmove(e, ownerInstance) {
61
+ var instance = e.instance;
62
+ var disabled = instance.getDataset().disabled
63
+ var state = instance.getState()
64
+ // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
65
+ disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
66
+ if (disabled) return
67
+ // 是否可以滑动页面
68
+ stopTouchMove(e);
69
+ if (state.direction !== 'horizontal') {
70
+ return;
71
+ }
72
+
73
+ if (e.preventDefault) {
74
+ // 阻止页面滚动
75
+ e.preventDefault()
76
+ }
77
+
78
+ move(state.x + state.deltaX, instance, ownerInstance)
79
+ }
80
+
81
+ /**
82
+ * 结束触摸操作
83
+ * @param {Object} e
84
+ * @param {Object} ownerInstance
85
+ */
86
+ function touchend(e, ownerInstance) {
87
+ var instance = e.instance;
88
+ var disabled = instance.getDataset().disabled
89
+ var state = instance.getState()
90
+ // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
91
+ disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
92
+
93
+ if (disabled) return
94
+ // 滑动过程中触摸结束,通过阙值判断是开启还是关闭
95
+ // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
96
+ moveDirection(state.left, instance, ownerInstance)
97
+
98
+ }
99
+
100
+ /**
101
+ * 设置移动距离
102
+ * @param {Object} value
103
+ * @param {Object} instance
104
+ * @param {Object} ownerInstance
105
+ */
106
+ function move(value, instance, ownerInstance) {
107
+ value = value || 0
108
+ var state = instance.getState()
109
+ var leftWidth = state.leftWidth
110
+ var rightWidth = state.rightWidth
111
+ // 获取可滑动范围
112
+ state.left = range(value, -rightWidth, leftWidth);
113
+ instance.requestAnimationFrame(function() {
114
+ instance.setStyle({
115
+ transform: 'translateX(' + state.left + 'px)',
116
+ '-webkit-transform': 'translateX(' + state.left + 'px)'
117
+ })
118
+ })
119
+
120
+ }
121
+
122
+ /**
123
+ * 获取元素信息
124
+ * @param {Object} instance
125
+ * @param {Object} ownerInstance
126
+ */
127
+ function getDom(instance, ownerInstance) {
128
+ var state = instance.getState()
129
+ var leftDom = ownerInstance.selectComponent('.button-group--left')
130
+ var rightDom = ownerInstance.selectComponent('.button-group--right')
131
+ var leftStyles = {
132
+ width: 0
133
+ }
134
+ var rightStyles = {
135
+ width: 0
136
+ }
137
+ leftStyles = leftDom.getBoundingClientRect()
138
+ rightStyles = rightDom.getBoundingClientRect()
139
+
140
+ state.leftWidth = leftStyles.width || 0
141
+ state.rightWidth = rightStyles.width || 0
142
+ state.threshold = instance.getDataset().threshold
143
+ }
144
+
145
+ /**
146
+ * 获取范围
147
+ * @param {Object} num
148
+ * @param {Object} min
149
+ * @param {Object} max
150
+ */
151
+ function range(num, min, max) {
152
+ return Math.min(Math.max(num, min), max);
153
+ }
154
+
155
+
156
+ /**
157
+ * 移动方向判断
158
+ * @param {Object} left
159
+ * @param {Object} value
160
+ * @param {Object} ownerInstance
161
+ * @param {Object} ins
162
+ */
163
+ function moveDirection(left, ins, ownerInstance) {
164
+ var state = ins.getState()
165
+ var threshold = state.threshold
166
+ var position = state.position
167
+ var isopen = state.isopen || 'none'
168
+ var leftWidth = state.leftWidth
169
+ var rightWidth = state.rightWidth
170
+ if (state.deltaX === 0) {
171
+ openState('none', ins, ownerInstance)
172
+ return
173
+ }
174
+ if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 &&
175
+ rightWidth +
176
+ left < threshold)) {
177
+ // right
178
+ openState('right', ins, ownerInstance)
179
+ } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
180
+ leftWidth - left < threshold)) {
181
+ // left
182
+ openState('left', ins, ownerInstance)
183
+ } else {
184
+ // default
185
+ openState('none', ins, ownerInstance)
186
+ }
187
+ }
188
+
189
+
190
+ /**
191
+ * 开启状态
192
+ * @param {Boolean} type
193
+ * @param {Object} ins
194
+ * @param {Object} ownerInstance
195
+ */
196
+ function openState(type, ins, ownerInstance) {
197
+ var state = ins.getState()
198
+ var leftWidth = state.leftWidth
199
+ var rightWidth = state.rightWidth
200
+ var left = ''
201
+ state.isopen = state.isopen ? state.isopen : 'none'
202
+ switch (type) {
203
+ case "left":
204
+ left = leftWidth
205
+ break
206
+ case "right":
207
+ left = -rightWidth
208
+ break
209
+ default:
210
+ left = 0
211
+ }
212
+
213
+ // && !state.throttle
214
+
215
+ if (state.isopen !== type) {
216
+ state.throttle = true
217
+ ownerInstance.callMethod('change', {
218
+ open: type
219
+ })
220
+
221
+ }
222
+
223
+ state.isopen = type
224
+ // 添加动画类
225
+ ins.requestAnimationFrame(function() {
226
+ ins.addClass('ani');
227
+ move(left, ins, ownerInstance)
228
+ })
229
+ // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
230
+ }
231
+
232
+
233
+ function getDirection(x, y) {
234
+ if (x > y && x > MIN_DISTANCE) {
235
+ return 'horizontal';
236
+ }
237
+ if (y > x && y > MIN_DISTANCE) {
238
+ return 'vertical';
239
+ }
240
+ return '';
241
+ }
242
+
243
+ /**
244
+ * 重置滑动状态
245
+ * @param {Object} event
246
+ */
247
+ function resetTouchStatus(instance) {
248
+ var state = instance.getState();
249
+ state.direction = '';
250
+ state.deltaX = 0;
251
+ state.deltaY = 0;
252
+ state.offsetX = 0;
253
+ state.offsetY = 0;
254
+ }
255
+
256
+ /**
257
+ * 设置滑动开始位置
258
+ * @param {Object} event
259
+ */
260
+ function stopTouchStart(event) {
261
+ var instance = event.instance;
262
+ var state = instance.getState();
263
+ resetTouchStatus(instance);
264
+ var touch = event.touches[0];
265
+ if (IS_HTML5 && isPC()) {
266
+ touch = event;
267
+ }
268
+ state.startX = touch.clientX;
269
+ state.startY = touch.clientY;
270
+ }
271
+
272
+ /**
273
+ * 滑动中,是否禁止打开
274
+ * @param {Object} event
275
+ */
276
+ function stopTouchMove(event) {
277
+ var instance = event.instance;
278
+ var state = instance.getState();
279
+ var touch = event.touches[0];
280
+ if (IS_HTML5 && isPC()) {
281
+ touch = event;
282
+ }
283
+ state.deltaX = touch.clientX - state.startX;
284
+ state.deltaY = touch.clientY - state.startY;
285
+ state.offsetY = Math.abs(state.deltaY);
286
+ state.offsetX = Math.abs(state.deltaX);
287
+ state.direction = state.direction || getDirection(state.offsetX, state.offsetY);
288
+ }
289
+
290
+ function isPC() {
291
+ var userAgentInfo = navigator.userAgent;
292
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
293
+ var flag = true;
294
+ for (var v = 0; v < Agents.length - 1; v++) {
295
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
296
+ flag = false;
297
+ break;
298
+ }
299
+ }
300
+ return flag;
301
+ }
302
+
303
+ var movable = false
304
+
305
+ function mousedown(e, ins) {
306
+ if (!IS_HTML5) return
307
+ if (!isPC()) return
308
+ touchstart(e, ins)
309
+ movable = true
310
+ }
311
+
312
+ function mousemove(e, ins) {
313
+ if (!IS_HTML5) return
314
+ if (!isPC()) return
315
+ if (!movable) return
316
+ touchmove(e, ins)
317
+ }
318
+
319
+ function mouseup(e, ins) {
320
+ if (!IS_HTML5) return
321
+ if (!isPC()) return
322
+ touchend(e, ins)
323
+ movable = false
324
+ }
325
+
326
+ function mouseleave(e, ins) {
327
+ if (!IS_HTML5) return
328
+ if (!isPC()) return
329
+ movable = false
330
+ }
331
+
332
+ module.exports = {
333
+ showWatch: showWatch,
334
+ touchstart: touchstart,
335
+ touchmove: touchmove,
336
+ touchend: touchend,
337
+ mousedown: mousedown,
338
+ mousemove: mousemove,
339
+ mouseup: mouseup,
340
+ mouseleave: mouseleave
341
+ }
@@ -0,0 +1,218 @@
1
+ <template>
2
+ <view class="uni-swiper__warp">
3
+ <slot />
4
+ <view v-if="mode === 'default'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='default'>
5
+ <view v-for="(item,index) in info" @click="clickItem(index)" :style="{
6
+ 'width': (index === current? dots.width*2:dots.width ) + 'px','height':dots.width/2 +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border-radius':'0px'}"
7
+ :key="index" class="uni-swiper__dots-item uni-swiper__dots-bar" />
8
+ </view>
9
+ <view v-if="mode === 'dot'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='dot'>
10
+ <view v-for="(item,index) in info" @click="clickItem(index)" :style="{
11
+ 'width': dots.width + 'px','height':dots.height +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}"
12
+ :key="index" class="uni-swiper__dots-item" />
13
+ </view>
14
+ <view v-if="mode === 'round'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='round'>
15
+ <view v-for="(item,index) in info" @click="clickItem(index)" :class="[index === current&&'uni-swiper__dots-long']" :style="{
16
+ 'width':(index === current? dots.width*3:dots.width ) + 'px','height':dots.height +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}"
17
+ :key="index" class="uni-swiper__dots-item " />
18
+ </view>
19
+ <view v-if="mode === 'nav'" key='nav' :style="{'background-color':dotsStyles.backgroundColor,'bottom':'0'}" class="uni-swiper__dots-box uni-swiper__dots-nav">
20
+ <text :style="{'color':dotsStyles.color}" class="uni-swiper__dots-nav-item">{{ (current+1)+"/"+info.length +' ' +info[current][field] }}</text>
21
+ </view>
22
+ <view v-if="mode === 'indexes'" key='indexes' :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box">
23
+ <view v-for="(item,index) in info" @click="clickItem(index)" :style="{
24
+ 'width':dots.width + 'px','height':dots.height +'px' ,'color':index === current?dots.selectedColor:dots.color,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}"
25
+ :key="index" class="uni-swiper__dots-item uni-swiper__dots-indexes"><text class="uni-swiper__dots-indexes-text">{{ index+1 }}</text></view>
26
+ </view>
27
+ </view>
28
+ </template>
29
+
30
+ <script>
31
+
32
+ /**
33
+ * SwiperDod 轮播图指示点
34
+ * @description 自定义轮播图指示点
35
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=284
36
+ * @property {Number} current 当前指示点索引,必须是通过 `swiper` 的 `change` 事件获取到的 `e.detail.current`
37
+ * @property {String} mode = [default|round|nav|indexes] 指示点的类型
38
+ * @value defualt 默认指示点
39
+ * @value round 圆形指示点
40
+ * @value nav 条形指示点
41
+ * @value indexes 索引指示点
42
+ * @property {String} field mode 为 nav 时,显示的内容字段(mode = nav 时必填)
43
+ * @property {String} info 轮播图的数据,通过数组长度决定指示点个数
44
+ * @property {Object} dotsStyles 指示点样式
45
+ * @event {Function} clickItem 组件触发点击事件时触发,e={currentIndex}
46
+ */
47
+
48
+ export default {
49
+ name: 'UniSwiperDot',
50
+ emits:['clickItem'],
51
+ props: {
52
+ info: {
53
+ type: Array,
54
+ default () {
55
+ return []
56
+ }
57
+ },
58
+ current: {
59
+ type: Number,
60
+ default: 0
61
+ },
62
+ dotsStyles: {
63
+ type: Object,
64
+ default () {
65
+ return {}
66
+ }
67
+ },
68
+ // 类型 :default(默认) indexes long nav
69
+ mode: {
70
+ type: String,
71
+ default: 'default'
72
+ },
73
+ // 只在 nav 模式下生效,变量名称
74
+ field: {
75
+ type: String,
76
+ default: ''
77
+ }
78
+ },
79
+ data() {
80
+ return {
81
+ dots: {
82
+ width: 6,
83
+ height: 6,
84
+ bottom: 10,
85
+ color: '#fff',
86
+ backgroundColor: 'rgba(0, 0, 0, .3)',
87
+ border: '1px rgba(0, 0, 0, .3) solid',
88
+ selectedBackgroundColor: '#333',
89
+ selectedBorder: '1px rgba(0, 0, 0, .9) solid'
90
+ }
91
+ }
92
+ },
93
+ watch: {
94
+ dotsStyles(newVal) {
95
+ this.dots = Object.assign(this.dots, this.dotsStyles)
96
+ },
97
+ mode(newVal) {
98
+ if (newVal === 'indexes') {
99
+ this.dots.width = 14
100
+ this.dots.height = 14
101
+ } else {
102
+ this.dots.width = 6
103
+ this.dots.height = 6
104
+ }
105
+ }
106
+
107
+ },
108
+ created() {
109
+ if (this.mode === 'indexes') {
110
+ this.dots.width = 12
111
+ this.dots.height = 12
112
+ }
113
+ this.dots = Object.assign(this.dots, this.dotsStyles)
114
+ },
115
+ methods: {
116
+ clickItem(index) {
117
+ this.$emit('clickItem', index)
118
+ }
119
+ }
120
+ }
121
+ </script>
122
+
123
+ <style lang="scss">
124
+ .uni-swiper__warp {
125
+ /* #ifndef APP-NVUE */
126
+ display: flex;
127
+ /* #endif */
128
+ flex: 1;
129
+ flex-direction: column;
130
+ position: relative;
131
+ overflow: hidden;
132
+ }
133
+
134
+ .uni-swiper__dots-box {
135
+ position: absolute;
136
+ bottom: 10px;
137
+ left: 0;
138
+ right: 0;
139
+ /* #ifndef APP-NVUE */
140
+ display: flex;
141
+ /* #endif */
142
+ flex: 1;
143
+ flex-direction: row;
144
+ justify-content: center;
145
+ align-items: center;
146
+ }
147
+
148
+ .uni-swiper__dots-item {
149
+ width: 8px;
150
+ border-radius: 100px;
151
+ margin-left: 6px;
152
+ background-color: rgba(0, 0, 0, 0.4);
153
+ /* #ifndef APP-NVUE */
154
+ cursor: pointer;
155
+ /* #endif */
156
+ /* #ifdef H5 */
157
+ // border-width: 5px 0;
158
+ // border-style: solid;
159
+ // border-color: transparent;
160
+ // background-clip: padding-box;
161
+ /* #endif */
162
+ // transition: width 0.2s linear; 不要取消注释,不然会不能变色
163
+ }
164
+
165
+ .uni-swiper__dots-item:first-child {
166
+ margin: 0;
167
+ }
168
+
169
+ .uni-swiper__dots-default {
170
+ border-radius: 100px;
171
+ }
172
+
173
+ .uni-swiper__dots-long {
174
+ border-radius: 50px;
175
+ }
176
+
177
+ .uni-swiper__dots-bar {
178
+ border-radius: 50px;
179
+ }
180
+
181
+ .uni-swiper__dots-nav {
182
+ bottom: 0px;
183
+ // height: 26px;
184
+ padding: 8px 0;
185
+ /* #ifndef APP-NVUE */
186
+ display: flex;
187
+ /* #endif */
188
+ flex: 1;
189
+ flex-direction: row;
190
+ justify-content: flex-start;
191
+ align-items: center;
192
+ background-color: rgba(0, 0, 0, 0.2);
193
+ }
194
+
195
+ .uni-swiper__dots-nav-item {
196
+ /* overflow: hidden;
197
+ text-overflow: ellipsis;
198
+ white-space: nowrap; */
199
+ font-size: 14px;
200
+ color: #fff;
201
+ margin: 0 15px;
202
+ }
203
+
204
+ .uni-swiper__dots-indexes {
205
+ /* #ifndef APP-NVUE */
206
+ display: flex;
207
+ /* #endif */
208
+ // flex: 1;
209
+ justify-content: center;
210
+ align-items: center;
211
+ }
212
+
213
+ .uni-swiper__dots-indexes-text {
214
+ color: #fff;
215
+ font-size: 12px;
216
+ line-height: 14px;
217
+ }
218
+ </style>