uview-ui-wjf 1.0.0

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 (368) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/changelog.md +388 -0
  4. package/components/u--form/u--form.vue +92 -0
  5. package/components/u--image/u--image.vue +73 -0
  6. package/components/u--input/u--input.vue +115 -0
  7. package/components/u--text/u--text.vue +72 -0
  8. package/components/u--textarea/u--textarea.vue +85 -0
  9. package/components/u-action-sheet/props.js +54 -0
  10. package/components/u-action-sheet/u-action-sheet.vue +278 -0
  11. package/components/u-album/props.js +59 -0
  12. package/components/u-album/u-album.vue +259 -0
  13. package/components/u-alert/props.js +44 -0
  14. package/components/u-alert/u-alert.vue +243 -0
  15. package/components/u-avatar/props.js +78 -0
  16. package/components/u-avatar/u-avatar.vue +173 -0
  17. package/components/u-avatar-group/props.js +52 -0
  18. package/components/u-avatar-group/u-avatar-group.vue +103 -0
  19. package/components/u-back-top/props.js +54 -0
  20. package/components/u-back-top/u-back-top.vue +129 -0
  21. package/components/u-badge/props.js +72 -0
  22. package/components/u-badge/u-badge.vue +171 -0
  23. package/components/u-button/nvue.scss +46 -0
  24. package/components/u-button/props.js +161 -0
  25. package/components/u-button/u-button.vue +495 -0
  26. package/components/u-button/vue.scss +80 -0
  27. package/components/u-calendar/header.vue +99 -0
  28. package/components/u-calendar/month.vue +579 -0
  29. package/components/u-calendar/props.js +144 -0
  30. package/components/u-calendar/u-calendar.vue +384 -0
  31. package/components/u-calendar/util.js +85 -0
  32. package/components/u-car-keyboard/props.js +14 -0
  33. package/components/u-car-keyboard/u-car-keyboard.vue +311 -0
  34. package/components/u-cell/props.js +110 -0
  35. package/components/u-cell/u-cell.vue +229 -0
  36. package/components/u-cell-group/props.js +14 -0
  37. package/components/u-cell-group/u-cell-group.vue +61 -0
  38. package/components/u-checkbox/props.js +69 -0
  39. package/components/u-checkbox/u-checkbox.vue +344 -0
  40. package/components/u-checkbox-group/props.js +82 -0
  41. package/components/u-checkbox-group/u-checkbox-group.vue +103 -0
  42. package/components/u-circle-progress/props.js +8 -0
  43. package/components/u-circle-progress/u-circle-progress.vue +198 -0
  44. package/components/u-code/props.js +34 -0
  45. package/components/u-code/u-code.vue +129 -0
  46. package/components/u-code-input/props.js +79 -0
  47. package/components/u-code-input/u-code-input.vue +252 -0
  48. package/components/u-col/props.js +29 -0
  49. package/components/u-col/u-col.vue +162 -0
  50. package/components/u-collapse/props.js +19 -0
  51. package/components/u-collapse/u-collapse.vue +90 -0
  52. package/components/u-collapse-item/props.js +59 -0
  53. package/components/u-collapse-item/u-collapse-item.vue +225 -0
  54. package/components/u-column-notice/props.js +55 -0
  55. package/components/u-column-notice/u-column-notice.vue +160 -0
  56. package/components/u-count-down/props.js +24 -0
  57. package/components/u-count-down/u-count-down.vue +163 -0
  58. package/components/u-count-down/utils.js +62 -0
  59. package/components/u-count-to/props.js +59 -0
  60. package/components/u-count-to/u-count-to.vue +184 -0
  61. package/components/u-datetime-picker/props.js +120 -0
  62. package/components/u-datetime-picker/u-datetime-picker.vue +361 -0
  63. package/components/u-divider/props.js +44 -0
  64. package/components/u-divider/u-divider.vue +116 -0
  65. package/components/u-dropdown/props.js +65 -0
  66. package/components/u-dropdown/u-dropdown.vue +127 -0
  67. package/components/u-dropdown-item/props.js +36 -0
  68. package/components/u-dropdown-item/u-dropdown-item.vue +127 -0
  69. package/components/u-empty/props.js +59 -0
  70. package/components/u-empty/u-empty.vue +128 -0
  71. package/components/u-form/props.js +45 -0
  72. package/components/u-form/u-form.vue +214 -0
  73. package/components/u-form-item/props.js +48 -0
  74. package/components/u-form-item/u-form-item.vue +235 -0
  75. package/components/u-gap/props.js +24 -0
  76. package/components/u-gap/u-gap.vue +38 -0
  77. package/components/u-grid/props.js +19 -0
  78. package/components/u-grid/u-grid.vue +97 -0
  79. package/components/u-grid-item/props.js +14 -0
  80. package/components/u-grid-item/u-grid-item.vue +209 -0
  81. package/components/u-icon/icons.js +214 -0
  82. package/components/u-icon/props.js +89 -0
  83. package/components/u-icon/u-icon.vue +237 -0
  84. package/components/u-image/props.js +84 -0
  85. package/components/u-image/u-image.vue +232 -0
  86. package/components/u-index-anchor/props.js +29 -0
  87. package/components/u-index-anchor/u-index-anchor.vue +91 -0
  88. package/components/u-index-item/props.js +5 -0
  89. package/components/u-index-item/u-index-item.vue +87 -0
  90. package/components/u-index-list/props.js +29 -0
  91. package/components/u-index-list/u-index-list.vue +440 -0
  92. package/components/u-input/props.js +187 -0
  93. package/components/u-input/u-input.vue +369 -0
  94. package/components/u-keyboard/props.js +84 -0
  95. package/components/u-keyboard/u-keyboard.vue +164 -0
  96. package/components/u-line/props.js +33 -0
  97. package/components/u-line/u-line.vue +62 -0
  98. package/components/u-line-progress/props.js +28 -0
  99. package/components/u-line-progress/u-line-progress.vue +144 -0
  100. package/components/u-link/props.js +39 -0
  101. package/components/u-link/u-link.vue +83 -0
  102. package/components/u-list/props.js +76 -0
  103. package/components/u-list/u-list.vue +157 -0
  104. package/components/u-list-item/props.js +9 -0
  105. package/components/u-list-item/u-list-item.vue +116 -0
  106. package/components/u-loading-icon/props.js +59 -0
  107. package/components/u-loading-icon/u-loading-icon.vue +343 -0
  108. package/components/u-loading-page/props.js +49 -0
  109. package/components/u-loading-page/u-loading-page.vue +115 -0
  110. package/components/u-loadmore/props.js +94 -0
  111. package/components/u-loadmore/u-loadmore.vue +150 -0
  112. package/components/u-modal/props.js +89 -0
  113. package/components/u-modal/u-modal.vue +228 -0
  114. package/components/u-navbar/props.js +84 -0
  115. package/components/u-navbar/u-navbar.vue +186 -0
  116. package/components/u-no-network/props.js +19 -0
  117. package/components/u-no-network/u-no-network.vue +220 -0
  118. package/components/u-notice-bar/props.js +70 -0
  119. package/components/u-notice-bar/u-notice-bar.vue +101 -0
  120. package/components/u-notify/props.js +49 -0
  121. package/components/u-notify/u-notify.vue +211 -0
  122. package/components/u-number-box/props.js +109 -0
  123. package/components/u-number-box/u-number-box.vue +416 -0
  124. package/components/u-number-keyboard/props.js +19 -0
  125. package/components/u-number-keyboard/u-number-keyboard.vue +196 -0
  126. package/components/u-overlay/props.js +24 -0
  127. package/components/u-overlay/u-overlay.vue +68 -0
  128. package/components/u-parse/node/node.vue +499 -0
  129. package/components/u-parse/parser.js +1075 -0
  130. package/components/u-parse/props.js +45 -0
  131. package/components/u-parse/u-parse.vue +366 -0
  132. package/components/u-picker/props.js +79 -0
  133. package/components/u-picker/u-picker.vue +286 -0
  134. package/components/u-picker-column/props.js +5 -0
  135. package/components/u-picker-column/u-picker-column.vue +27 -0
  136. package/components/u-popup/props.js +79 -0
  137. package/components/u-popup/u-popup.vue +304 -0
  138. package/components/u-radio/props.js +64 -0
  139. package/components/u-radio/u-radio.vue +339 -0
  140. package/components/u-radio-group/props.js +85 -0
  141. package/components/u-radio-group/u-radio-group.vue +108 -0
  142. package/components/u-rate/props.js +69 -0
  143. package/components/u-rate/u-rate.vue +306 -0
  144. package/components/u-read-more/props.js +61 -0
  145. package/components/u-read-more/u-read-more.vue +157 -0
  146. package/components/u-row/props.js +19 -0
  147. package/components/u-row/u-row.vue +93 -0
  148. package/components/u-row-notice/props.js +39 -0
  149. package/components/u-row-notice/u-row-notice.vue +330 -0
  150. package/components/u-safe-bottom/props.js +5 -0
  151. package/components/u-safe-bottom/u-safe-bottom.vue +56 -0
  152. package/components/u-scroll-list/nvue.js +28 -0
  153. package/components/u-scroll-list/other.js +0 -0
  154. package/components/u-scroll-list/props.js +34 -0
  155. package/components/u-scroll-list/scrollWxs.wxs +50 -0
  156. package/components/u-scroll-list/u-scroll-list.vue +224 -0
  157. package/components/u-search/props.js +118 -0
  158. package/components/u-search/u-search.vue +303 -0
  159. package/components/u-skeleton/props.js +59 -0
  160. package/components/u-skeleton/u-skeleton.vue +244 -0
  161. package/components/u-slider/mpother.js +113 -0
  162. package/components/u-slider/mpwxs.js +42 -0
  163. package/components/u-slider/mpwxs.wxs +121 -0
  164. package/components/u-slider/nvue - /345/211/257/346/234/254.js" +180 -0
  165. package/components/u-slider/nvue.js +193 -0
  166. package/components/u-slider/props.js +54 -0
  167. package/components/u-slider/u-slider.vue +55 -0
  168. package/components/u-status-bar/props.js +8 -0
  169. package/components/u-status-bar/u-status-bar.vue +46 -0
  170. package/components/u-steps/props.js +39 -0
  171. package/components/u-steps/u-steps.vue +80 -0
  172. package/components/u-steps-item/props.js +24 -0
  173. package/components/u-steps-item/u-steps-item.vue +316 -0
  174. package/components/u-sticky/props.js +40 -0
  175. package/components/u-sticky/u-sticky.vue +212 -0
  176. package/components/u-subsection/props.js +49 -0
  177. package/components/u-subsection/u-subsection.vue +299 -0
  178. package/components/u-swipe-action/props.js +9 -0
  179. package/components/u-swipe-action/u-swipe-action.vue +67 -0
  180. package/components/u-swipe-action-item/index - backup.wxs +256 -0
  181. package/components/u-swipe-action-item/index.wxs +225 -0
  182. package/components/u-swipe-action-item/nvue - backup.js +270 -0
  183. package/components/u-swipe-action-item/nvue.js +174 -0
  184. package/components/u-swipe-action-item/props.js +41 -0
  185. package/components/u-swipe-action-item/u-swipe-action-item.vue +190 -0
  186. package/components/u-swipe-action-item/wxs.js +15 -0
  187. package/components/u-swiper/props.js +125 -0
  188. package/components/u-swiper/u-swiper.vue +255 -0
  189. package/components/u-swiper-indicator/props.js +29 -0
  190. package/components/u-swiper-indicator/u-swiper-indicator.vue +110 -0
  191. package/components/u-switch/props.js +54 -0
  192. package/components/u-switch/u-switch.vue +177 -0
  193. package/components/u-tabbar/props.js +44 -0
  194. package/components/u-tabbar/u-tabbar.vue +141 -0
  195. package/components/u-tabbar-item/props.js +35 -0
  196. package/components/u-tabbar-item/u-tabbar-item.vue +142 -0
  197. package/components/u-table/props.js +5 -0
  198. package/components/u-table/u-table.vue +29 -0
  199. package/components/u-tabs/props.js +64 -0
  200. package/components/u-tabs/u-tabs.vue +363 -0
  201. package/components/u-tabs-item/props.js +5 -0
  202. package/components/u-tabs-item/u-tabs-item.vue +29 -0
  203. package/components/u-tag/props.js +84 -0
  204. package/components/u-tag/u-tag.vue +358 -0
  205. package/components/u-td/props.js +5 -0
  206. package/components/u-td/u-td.vue +31 -0
  207. package/components/u-text/props.js +110 -0
  208. package/components/u-text/u-text.vue +223 -0
  209. package/components/u-text/value.js +85 -0
  210. package/components/u-textarea/props.js +119 -0
  211. package/components/u-textarea/u-textarea.vue +239 -0
  212. package/components/u-toast/u-toast.vue +291 -0
  213. package/components/u-toolbar/props.js +34 -0
  214. package/components/u-toolbar/u-toolbar.vue +102 -0
  215. package/components/u-tooltip/clipboard.min.js +58 -0
  216. package/components/u-tooltip/props.js +59 -0
  217. package/components/u-tooltip/u-tooltip.vue +366 -0
  218. package/components/u-tr/props.js +5 -0
  219. package/components/u-tr/u-tr.vue +31 -0
  220. package/components/u-transition/nvue.ani-map.js +68 -0
  221. package/components/u-transition/props.js +24 -0
  222. package/components/u-transition/transition.js +157 -0
  223. package/components/u-transition/u-transition.vue +92 -0
  224. package/components/u-transition/vue.ani-style.scss +113 -0
  225. package/components/u-upload/mixin.js +21 -0
  226. package/components/u-upload/props.js +124 -0
  227. package/components/u-upload/u-upload.vue +566 -0
  228. package/components/u-upload/utils.js +151 -0
  229. package/components/uview-ui/uview-ui.vue +15 -0
  230. package/index.js +79 -0
  231. package/index.scss +23 -0
  232. package/libs/config/color.js +17 -0
  233. package/libs/config/config.js +34 -0
  234. package/libs/config/props/actionSheet.js +25 -0
  235. package/libs/config/props/album.js +25 -0
  236. package/libs/config/props/alert.js +22 -0
  237. package/libs/config/props/avatar.js +28 -0
  238. package/libs/config/props/avatarGroup.js +23 -0
  239. package/libs/config/props/backtop.js +27 -0
  240. package/libs/config/props/badge.js +27 -0
  241. package/libs/config/props/button.js +42 -0
  242. package/libs/config/props/calendar.js +42 -0
  243. package/libs/config/props/carKeyboard.js +15 -0
  244. package/libs/config/props/cell.js +35 -0
  245. package/libs/config/props/cellGroup.js +17 -0
  246. package/libs/config/props/checkbox.js +27 -0
  247. package/libs/config/props/checkboxGroup.js +29 -0
  248. package/libs/config/props/circleProgress.js +15 -0
  249. package/libs/config/props/code.js +21 -0
  250. package/libs/config/props/codeInput.js +29 -0
  251. package/libs/config/props/col.js +19 -0
  252. package/libs/config/props/collapse.js +17 -0
  253. package/libs/config/props/collapseItem.js +25 -0
  254. package/libs/config/props/columnNotice.js +24 -0
  255. package/libs/config/props/countDown.js +18 -0
  256. package/libs/config/props/countTo.js +25 -0
  257. package/libs/config/props/datetimePicker.js +37 -0
  258. package/libs/config/props/divider.js +23 -0
  259. package/libs/config/props/empty.js +26 -0
  260. package/libs/config/props/form.js +22 -0
  261. package/libs/config/props/formItem.js +23 -0
  262. package/libs/config/props/gap.js +19 -0
  263. package/libs/config/props/grid.js +17 -0
  264. package/libs/config/props/gridItem.js +16 -0
  265. package/libs/config/props/icon.js +36 -0
  266. package/libs/config/props/image.js +30 -0
  267. package/libs/config/props/indexAnchor.js +19 -0
  268. package/libs/config/props/indexList.js +19 -0
  269. package/libs/config/props/input.js +48 -0
  270. package/libs/config/props/keyboard.js +30 -0
  271. package/libs/config/props/line.js +20 -0
  272. package/libs/config/props/lineProgress.js +19 -0
  273. package/libs/config/props/link.js +26 -0
  274. package/libs/config/props/list.js +28 -0
  275. package/libs/config/props/listItem.js +15 -0
  276. package/libs/config/props/loadingIcon.js +30 -0
  277. package/libs/config/props/loadingPage.js +23 -0
  278. package/libs/config/props/loadmore.js +32 -0
  279. package/libs/config/props/modal.js +31 -0
  280. package/libs/config/props/navbar.js +32 -0
  281. package/libs/config/props/noNetwork.js +18 -0
  282. package/libs/config/props/noticeBar.js +27 -0
  283. package/libs/config/props/notify.js +22 -0
  284. package/libs/config/props/numberBox.js +35 -0
  285. package/libs/config/props/numberKeyboard.js +17 -0
  286. package/libs/config/props/overlay.js +18 -0
  287. package/libs/config/props/parse.js +22 -0
  288. package/libs/config/props/picker.js +29 -0
  289. package/libs/config/props/popup.js +29 -0
  290. package/libs/config/props/radio.js +27 -0
  291. package/libs/config/props/radioGroup.js +30 -0
  292. package/libs/config/props/rate.js +26 -0
  293. package/libs/config/props/readMore.js +22 -0
  294. package/libs/config/props/row.js +17 -0
  295. package/libs/config/props/rowNotice.js +21 -0
  296. package/libs/config/props/scrollList.js +20 -0
  297. package/libs/config/props/search.js +37 -0
  298. package/libs/config/props/section.js +24 -0
  299. package/libs/config/props/skeleton.js +25 -0
  300. package/libs/config/props/slider.js +25 -0
  301. package/libs/config/props/statusBar.js +15 -0
  302. package/libs/config/props/steps.js +21 -0
  303. package/libs/config/props/stepsItem.js +18 -0
  304. package/libs/config/props/sticky.js +20 -0
  305. package/libs/config/props/subsection.js +23 -0
  306. package/libs/config/props/swipeAction.js +15 -0
  307. package/libs/config/props/swipeActionItem.js +21 -0
  308. package/libs/config/props/swiper.js +39 -0
  309. package/libs/config/props/swipterIndicator.js +19 -0
  310. package/libs/config/props/switch.js +24 -0
  311. package/libs/config/props/tabbar.js +22 -0
  312. package/libs/config/props/tabbarItem.js +20 -0
  313. package/libs/config/props/tabs.js +32 -0
  314. package/libs/config/props/tag.js +29 -0
  315. package/libs/config/props/text.js +38 -0
  316. package/libs/config/props/textarea.js +36 -0
  317. package/libs/config/props/toast.js +30 -0
  318. package/libs/config/props/toolbar.js +21 -0
  319. package/libs/config/props/tooltip.js +25 -0
  320. package/libs/config/props/transition.js +18 -0
  321. package/libs/config/props/upload.js +36 -0
  322. package/libs/config/props.js +190 -0
  323. package/libs/config/zIndex.js +20 -0
  324. package/libs/css/color.scss +155 -0
  325. package/libs/css/common.scss +97 -0
  326. package/libs/css/components.scss +15 -0
  327. package/libs/css/flex.scss +257 -0
  328. package/libs/css/h5.scss +0 -0
  329. package/libs/css/mixin.scss +8 -0
  330. package/libs/css/mp.scss +0 -0
  331. package/libs/css/nvue.scss +0 -0
  332. package/libs/css/vue.scss +27 -0
  333. package/libs/function/colorGradient.js +134 -0
  334. package/libs/function/debounce.js +29 -0
  335. package/libs/function/digit.js +167 -0
  336. package/libs/function/index.js +731 -0
  337. package/libs/function/platform.js +75 -0
  338. package/libs/function/test.js +288 -0
  339. package/libs/function/throttle.js +30 -0
  340. package/libs/luch-request/adapters/index.js +97 -0
  341. package/libs/luch-request/core/InterceptorManager.js +50 -0
  342. package/libs/luch-request/core/Request.js +198 -0
  343. package/libs/luch-request/core/buildFullPath.js +20 -0
  344. package/libs/luch-request/core/defaults.js +29 -0
  345. package/libs/luch-request/core/dispatchRequest.js +3 -0
  346. package/libs/luch-request/core/mergeConfig.js +103 -0
  347. package/libs/luch-request/core/settle.js +16 -0
  348. package/libs/luch-request/helpers/buildURL.js +69 -0
  349. package/libs/luch-request/helpers/combineURLs.js +14 -0
  350. package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
  351. package/libs/luch-request/index.d.ts +116 -0
  352. package/libs/luch-request/index.js +3 -0
  353. package/libs/luch-request/utils/clone.js +264 -0
  354. package/libs/luch-request/utils.js +131 -0
  355. package/libs/mixin/button.js +13 -0
  356. package/libs/mixin/mixin.js +160 -0
  357. package/libs/mixin/mpMixin.js +8 -0
  358. package/libs/mixin/mpShare.js +13 -0
  359. package/libs/mixin/openType.js +25 -0
  360. package/libs/mixin/style.js +228 -0
  361. package/libs/mixin/touch.js +59 -0
  362. package/libs/util/async-validator.js +1343 -0
  363. package/libs/util/calendar.js +546 -0
  364. package/libs/util/dayjs.js +308 -0
  365. package/libs/util/emitter.js +51 -0
  366. package/libs/util/route.js +124 -0
  367. package/package.json +83 -0
  368. package/theme.scss +44 -0
@@ -0,0 +1,316 @@
1
+ <template>
2
+ <view class="u-steps-item" ref="u-steps-item" :class="[`u-steps-item--${parentData.direction}`]">
3
+ <view class="u-steps-item__line" v-if="index + 1 < childLength"
4
+ :class="[`u-steps-item__line--${parentData.direction}`]" :style="[lineStyle]"></view>
5
+ <view class="u-steps-item__wrapper"
6
+ :class="[`u-steps-item__wrapper--${parentData.direction}`, parentData.dot && `u-steps-item__wrapper--${parentData.direction}--dot`]">
7
+ <slot name="icon">
8
+ <view class="u-steps-item__wrapper__dot" v-if="parentData.dot" :style="{
9
+ backgroundColor: statusColor
10
+ }">
11
+
12
+ </view>
13
+ <view class="u-steps-item__wrapper__icon" v-else-if="parentData.activeIcon || parentData.inactiveIcon">
14
+ <u-icon :name="index <= parentData.current ? parentData.activeIcon : parentData.inactiveIcon"
15
+ :size="iconSize"
16
+ :color="index <= parentData.current ? parentData.activeColor : parentData.inactiveColor">
17
+ </u-icon>
18
+ </view>
19
+ <view v-else :style="{
20
+ backgroundColor: statusClass === 'process' ? parentData.activeColor : 'transparent',
21
+ borderColor: statusColor
22
+ }" class="u-steps-item__wrapper__circle">
23
+ <text v-if="statusClass === 'process' || statusClass === 'wait'"
24
+ class="u-steps-item__wrapper__circle__text" :style="{
25
+ color: index == parentData.current ? '#ffffff' : parentData.inactiveColor
26
+ }">{{ index + 1}}</text>
27
+ <u-icon v-else :color="statusClass === 'error' ? 'error' : parentData.activeColor" size="12"
28
+ :name="statusClass === 'error' ? 'close' : 'checkmark'"></u-icon>
29
+ </view>
30
+ </slot>
31
+ </view>
32
+ <view class="u-steps-item__content" :class="[`u-steps-item__content--${parentData.direction}`]"
33
+ :style="[contentStyle]">
34
+ <u--text :text="title" :type="parentData.current == index ? 'main' : 'content'" lineHeight="20px"
35
+ :size="parentData.current == index ? 14 : 13"></u--text>
36
+ <slot name="desc">
37
+ <u--text :text="desc" type="tips" size="12"></u--text>
38
+ </slot>
39
+ </view>
40
+ <!-- <view
41
+ class="u-steps-item__line"
42
+ v-if="showLine && parentData.direction === 'column'"
43
+ :class="[`u-steps-item__line--${parentData.direction}`]"
44
+ :style="[lineStyle]"
45
+ ></view> -->
46
+ </view>
47
+ </template>
48
+
49
+ <script>
50
+ import props from './props.js';
51
+ // #ifdef APP-NVUE
52
+ const dom = uni.requireNativePlugin('dom')
53
+ // #endif
54
+ /**
55
+ * StepsItem 步骤条的子组件
56
+ * @description 本组件需要和u-steps配合使用
57
+ * @tutorial https://uviewui.com/components/steps.html
58
+ * @property {String} title 标题文字
59
+ * @property {String} current 描述文本
60
+ * @property {String | Number} iconSize 图标大小 (默认 17 )
61
+ * @property {Boolean} error 当前步骤是否处于失败状态 (默认 false )
62
+ * @example <u-steps current="0"><u-steps-item title="已出库" desc="10:35" ></u-steps-item></u-steps>
63
+ */
64
+ export default {
65
+ name: 'u-steps-item',
66
+ mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
67
+ data() {
68
+ return {
69
+ index: 0,
70
+ childLength: 0,
71
+ showLine: false,
72
+ size: {
73
+ height: 0,
74
+ width: 0
75
+ },
76
+ parentData: {
77
+ direction: 'row',
78
+ current: 0,
79
+ activeColor: '',
80
+ inactiveColor: '',
81
+ activeIcon: '',
82
+ inactiveIcon: '',
83
+ dot: false
84
+ }
85
+ }
86
+ },
87
+ watch: {
88
+ 'parentData'(newValue, oldValue) {
89
+ }
90
+ },
91
+ created() {
92
+ this.init()
93
+ },
94
+ computed: {
95
+ lineStyle() {
96
+ const style = {}
97
+ if (this.parentData.direction === 'row') {
98
+ style.width = this.size.width + 'px'
99
+ style.left = this.size.width / 2 + 'px'
100
+ } else {
101
+ style.height = this.size.height + 'px'
102
+ // style.top = this.size.height / 2 + 'px'
103
+ }
104
+ style.backgroundColor = this.parent.children?.[this.index + 1]?.error ? uni.$u.color.error : this.index <
105
+ this
106
+ .parentData
107
+ .current ? this.parentData.activeColor : this.parentData.inactiveColor
108
+ return style
109
+ },
110
+ statusClass() {
111
+ const {
112
+ index,
113
+ error
114
+ } = this
115
+ const {
116
+ current
117
+ } = this.parentData
118
+ if (current == index) {
119
+ return error === true ? 'error' : 'process'
120
+ } else if (error) {
121
+ return 'error'
122
+ } else if (current > index) {
123
+ return 'finish'
124
+ } else {
125
+ return 'wait'
126
+ }
127
+ },
128
+ statusColor() {
129
+ let color = ''
130
+ switch (this.statusClass) {
131
+ case 'finish':
132
+ color = this.parentData.activeColor
133
+ break
134
+ case 'error':
135
+ color = uni.$u.color.error
136
+ break
137
+ case 'process':
138
+ color = this.parentData.dot ? this.parentData.activeColor : 'transparent'
139
+ break
140
+ default:
141
+ color = this.parentData.inactiveColor
142
+ break
143
+ }
144
+ return color
145
+ },
146
+ contentStyle() {
147
+ const style = {}
148
+ if (this.parentData.direction === 'column') {
149
+ style.marginLeft = this.parentData.dot ? '2px' : '6px'
150
+ style.marginTop = this.parentData.dot ? '0px' : '6px'
151
+ } else {
152
+ style.marginTop = this.parentData.dot ? '2px' : '6px'
153
+ style.marginLeft = this.parentData.dot ? '2px' : '6px'
154
+ }
155
+
156
+ return style
157
+ }
158
+ },
159
+ mounted() {
160
+ this.parent && this.parent.updateFromChild()
161
+ uni.$u.sleep().then(() => {
162
+ this.getStepsItemRect()
163
+ })
164
+ },
165
+ methods: {
166
+ init() {
167
+ // 初始化数据
168
+ this.updateParentData()
169
+ if (!this.parent) {
170
+ return uni.$u.error('u-steps-item必须要搭配u-steps组件使用')
171
+ }
172
+ this.index = this.parent.children.indexOf(this)
173
+ this.childLength = this.parent.children.length
174
+ },
175
+ updateParentData() {
176
+ // 此方法在mixin中
177
+ this.getParentData('u-steps')
178
+ },
179
+ // 父组件数据发生变化
180
+ updateFromParent() {
181
+ this.init()
182
+ },
183
+ // 获取组件的尺寸,用于设置横线的位置
184
+ getStepsItemRect() {
185
+ // #ifndef APP-NVUE
186
+ this.$uGetRect('.u-steps-item').then(size => {
187
+ this.size = size
188
+ })
189
+ // #endif
190
+
191
+ // #ifdef APP-NVUE
192
+ dom.getComponentRect(this.$refs['u-steps-item'], res => {
193
+ const {
194
+ size
195
+ } = res
196
+ this.size = size
197
+ })
198
+ // #endif
199
+ }
200
+ }
201
+ }
202
+ </script>
203
+
204
+ <style lang="scss" scoped>
205
+ @import "../../libs/css/components.scss";
206
+
207
+ .u-steps-item {
208
+ flex: 1;
209
+ @include flex;
210
+
211
+ &--row {
212
+ flex-direction: column;
213
+ align-items: center;
214
+ position: relative;
215
+ }
216
+
217
+ &--column {
218
+ position: relative;
219
+ flex-direction: row;
220
+ justify-content: flex-start;
221
+ padding-bottom: 5px;
222
+ }
223
+
224
+ &__wrapper {
225
+ @include flex;
226
+ justify-content: center;
227
+ align-items: center;
228
+ position: relative;
229
+ background-color: #fff;
230
+
231
+ &--column {
232
+ width: 20px;
233
+ height: 32px;
234
+
235
+ &--dot {
236
+ height: 20px;
237
+ width: 20px;
238
+ }
239
+ }
240
+
241
+ &--row {
242
+ width: 32px;
243
+ height: 20px;
244
+
245
+ &--dot {
246
+ width: 20px;
247
+ height: 20px;
248
+ }
249
+ }
250
+
251
+ &__circle {
252
+ width: 20px;
253
+ height: 20px;
254
+ /* #ifndef APP-NVUE */
255
+ box-sizing: border-box;
256
+ flex-shrink: 0;
257
+ /* #endif */
258
+ border-radius: 100px;
259
+ border-width: 1px;
260
+ border-color: $u-tips-color;
261
+ border-style: solid;
262
+ @include flex(row);
263
+ align-items: center;
264
+ justify-content: center;
265
+ transition: background-color 0.3s;
266
+
267
+ &__text {
268
+ color: $u-tips-color;
269
+ font-size: 11px;
270
+ @include flex(row);
271
+ align-items: center;
272
+ justify-content: center;
273
+ text-align: center;
274
+ line-height: 11px;
275
+ }
276
+ }
277
+
278
+ &__dot {
279
+ width: 10px;
280
+ height: 10px;
281
+ border-radius: 100px;
282
+ background-color: $u-content-color;
283
+ }
284
+ }
285
+
286
+ &__content {
287
+ @include flex;
288
+ flex: 1;
289
+
290
+ &--row {
291
+ flex-direction: column;
292
+ align-items: center;
293
+ }
294
+
295
+ &--column {
296
+ flex-direction: column;
297
+ margin-left: 6px;
298
+ }
299
+ }
300
+
301
+ &__line {
302
+ position: absolute;
303
+ background: $u-tips-color;
304
+
305
+ &--row {
306
+ top: 10px;
307
+ height: 1px;
308
+ }
309
+
310
+ &--column {
311
+ width: 1px;
312
+ left: 10px;
313
+ }
314
+ }
315
+ }
316
+ </style>
@@ -0,0 +1,40 @@
1
+ export default {
2
+ props: {
3
+ // 吸顶容器到顶部某个距离的时候,进行吸顶,在H5平台,NavigationBar为44px
4
+ offsetTop: {
5
+ type: [String, Number],
6
+ default: uni.$u.props.sticky.offsetTop
7
+ },
8
+ // 自定义导航栏的高度
9
+ customNavHeight: {
10
+ type: [String, Number],
11
+ // #ifdef H5
12
+ // H5端的导航栏属于“自定义”导航栏的范畴,因为它是非原生的,与普通元素一致
13
+ default: 44,
14
+ // #endif
15
+ // #ifndef H5
16
+ default: uni.$u.props.sticky.customNavHeight
17
+ // #endif
18
+ },
19
+ // 是否开启吸顶功能
20
+ disabled: {
21
+ type: Boolean,
22
+ default: uni.$u.props.sticky.disabled
23
+ },
24
+ // 吸顶区域的背景颜色
25
+ bgColor: {
26
+ type: String,
27
+ default: uni.$u.props.sticky.bgColor
28
+ },
29
+ // z-index值
30
+ zIndex: {
31
+ type: [String, Number],
32
+ default: uni.$u.props.sticky.zIndex
33
+ },
34
+ // 列表中的索引值
35
+ index: {
36
+ type: [String, Number],
37
+ default: uni.$u.props.sticky.index
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,212 @@
1
+ <template>
2
+ <view
3
+ class="u-sticky"
4
+ :id="elId"
5
+ :style="[style]"
6
+ >
7
+ <view
8
+ :style="[stickyContent]"
9
+ class="u-sticky__content"
10
+ >
11
+ <slot />
12
+ </view>
13
+ </view>
14
+ </template>
15
+
16
+ <script>
17
+ import props from './props.js';;
18
+ /**
19
+ * sticky 吸顶
20
+ * @description 该组件与CSS中position: sticky属性实现的效果一致,当组件达到预设的到顶部距离时, 就会固定在指定位置,组件位置大于预设的顶部距离时,会重新按照正常的布局排列。
21
+ * @tutorial https://www.uviewui.com/components/sticky.html
22
+ * @property {String | Number} offsetTop 吸顶时与顶部的距离,单位px(默认 0 )
23
+ * @property {String | Number} customNavHeight 自定义导航栏的高度 (h5 默认44 其他默认 0 )
24
+ * @property {Boolean} disabled 是否开启吸顶功能 (默认 false )
25
+ * @property {String} bgColor 组件背景颜色(默认 '#ffffff' )
26
+ * @property {String | Number} zIndex 吸顶时的z-index值
27
+ * @property {String | Number} index 自定义标识,用于区分是哪一个组件
28
+ * @property {Object} customStyle 组件的样式,对象形式
29
+ * @event {Function} fixed 组件吸顶时触发
30
+ * @event {Function} unfixed 组件取消吸顶时触发
31
+ * @example <u-sticky offsetTop="200"><view>塞下秋来风景异,衡阳雁去无留意</view></u-sticky>
32
+ */
33
+ export default {
34
+ name: 'u-sticky',
35
+ mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
36
+ data() {
37
+ return {
38
+ cssSticky: false, // 是否使用css的sticky实现
39
+ stickyTop: 0, // 吸顶的top值,因为可能受自定义导航栏影响,最终的吸顶值非offsetTop值
40
+ elId: uni.$u.guid(),
41
+ left: 0, // js模式时,吸顶的内容因为处于postition: fixed模式,为了和原来保持一致的样式,需要记录并重新设置它的left,height,width属性
42
+ width: 'auto',
43
+ height: 'auto',
44
+ fixed: false, // js模式时,是否处于吸顶模式
45
+ }
46
+ },
47
+ computed: {
48
+ style() {
49
+ const style = {}
50
+ if(!this.disabled) {
51
+ if (this.cssSticky) {
52
+ style.position = 'sticky'
53
+ style.zIndex = this.uZindex
54
+ style.top = uni.$u.addUnit(this.stickyTop)
55
+ } else {
56
+ style.height = this.fixed ? this.height + 'px' : 'auto'
57
+ }
58
+ } else {
59
+ // 无需吸顶时,设置会默认的relative(nvue)和非nvue的static静态模式即可
60
+ // #ifdef APP-NVUE
61
+ style.position = 'relative'
62
+ // #endif
63
+ // #ifndef APP-NVUE
64
+ style.position = 'static'
65
+ // #endif
66
+ }
67
+ style.backgroundColor = this.bgColor
68
+ return uni.$u.deepMerge(uni.$u.addStyle(this.customStyle), style)
69
+ },
70
+ // 吸顶内容的样式
71
+ stickyContent() {
72
+ const style = {}
73
+ if (!this.cssSticky) {
74
+ style.position = this.fixed ? 'fixed' : 'static'
75
+ style.top = this.stickyTop + 'px'
76
+ style.left = this.left + 'px'
77
+ style.width = this.width == 'auto' ? 'auto' : this.width + 'px'
78
+ style.zIndex = this.uZindex
79
+ }
80
+ return style
81
+ },
82
+ uZindex() {
83
+ return this.zIndex ? this.zIndex : uni.$u.zIndex.sticky
84
+ }
85
+ },
86
+ mounted() {
87
+ this.init()
88
+ },
89
+ methods: {
90
+ init() {
91
+ this.getStickyTop()
92
+ // 判断使用的模式
93
+ this.checkSupportCssSticky()
94
+ // 如果不支持css sticky,则使用js方案,此方案性能比不上css方案
95
+ if (!this.cssSticky) {
96
+ !this.disabled && this.initObserveContent()
97
+ }
98
+ },
99
+ initObserveContent() {
100
+ // 获取吸顶内容的高度,用于在js吸顶模式时,给父元素一个填充高度,防止"塌陷"
101
+ this.$uGetRect('#' + this.elId).then((res) => {
102
+ this.height = res.height
103
+ this.left = res.left
104
+ this.width = res.width
105
+ this.$nextTick(() => {
106
+ this.observeContent()
107
+ })
108
+ })
109
+ },
110
+ observeContent() {
111
+ // 先断掉之前的观察
112
+ this.disconnectObserver('contentObserver')
113
+ const contentObserver = uni.createIntersectionObserver({
114
+ // 检测的区间范围
115
+ thresholds: [0.95, 0.98, 1]
116
+ })
117
+ // 到屏幕顶部的高度时触发
118
+ contentObserver.relativeToViewport({
119
+ top: -this.stickyTop
120
+ })
121
+ // 绑定观察的元素
122
+ contentObserver.observe(`#${this.elId}`, res => {
123
+ this.setFixed(res.boundingClientRect.top)
124
+ })
125
+ this.contentObserver = contentObserver
126
+ },
127
+ setFixed(top) {
128
+ // 判断是否出于吸顶条件范围
129
+ const fixed = top <= this.stickyTop
130
+ this.fixed = fixed
131
+ },
132
+ disconnectObserver(observerName) {
133
+ // 断掉观察,释放资源
134
+ const observer = this[observerName]
135
+ observer && observer.disconnect()
136
+ },
137
+ getStickyTop() {
138
+ this.stickyTop = uni.$u.getPx(this.offsetTop) + uni.$u.getPx(this.customNavHeight)
139
+ },
140
+ async checkSupportCssSticky() {
141
+ // #ifdef H5
142
+ // H5,一般都是现代浏览器,是支持css sticky的,这里使用创建元素嗅探的形式判断
143
+ if (this.checkCssStickyForH5()) {
144
+ this.cssSticky = true
145
+ }
146
+ // #endif
147
+
148
+ // 如果安卓版本高于8.0,依然认为是支持css sticky的(因为安卓7在某些机型,可能不支持sticky)
149
+ if (uni.$u.os() === 'android' && Number(uni.$u.sys().system) > 8) {
150
+ this.cssSticky = true
151
+ }
152
+
153
+ // APP-Vue和微信平台,通过computedStyle判断是否支持css sticky
154
+ // #ifdef APP-VUE || MP-WEIXIN
155
+ this.cssSticky = await this.checkComputedStyle()
156
+ // #endif
157
+
158
+ // ios上,从ios6开始,都是支持css sticky的
159
+ if (uni.$u.os() === 'ios') {
160
+ this.cssSticky = true
161
+ }
162
+
163
+ // nvue,是支持css sticky的
164
+ // #ifdef APP-NVUE
165
+ this.cssSticky = true
166
+ // #endif
167
+ },
168
+ // 在APP和微信小程序上,通过uni.createSelectorQuery可以判断是否支持css sticky
169
+ checkComputedStyle() {
170
+ // 方法内进行判断,避免在其他平台生成无用代码
171
+ // #ifdef APP-VUE || MP-WEIXIN
172
+ return new Promise(resolve => {
173
+ uni.createSelectorQuery().in(this).select('.u-sticky').fields({
174
+ computedStyle: ["position"]
175
+ }).exec(e => {
176
+ resolve('sticky' === e[0].position)
177
+ })
178
+ })
179
+ // #endif
180
+ },
181
+ // H5通过创建元素的形式嗅探是否支持css sticky
182
+ // 判断浏览器是否支持sticky属性
183
+ checkCssStickyForH5() {
184
+ // 方法内进行判断,避免在其他平台生成无用代码
185
+ // #ifdef H5
186
+ const vendorList = ['', '-webkit-', '-ms-', '-moz-', '-o-'],
187
+ vendorListLength = vendorList.length,
188
+ stickyElement = document.createElement('div')
189
+ for (let i = 0; i < vendorListLength; i++) {
190
+ stickyElement.style.position = vendorList[i] + 'sticky'
191
+ if (stickyElement.style.position !== '') {
192
+ return true
193
+ }
194
+ }
195
+ return false;
196
+ // #endif
197
+ }
198
+ },
199
+ beforeDestroy() {
200
+ this.disconnectObserver('contentObserver')
201
+ }
202
+ }
203
+ </script>
204
+
205
+ <style lang="scss" scoped>
206
+ .u-sticky {
207
+ /* #ifdef APP-VUE || MP-WEIXIN */
208
+ // 此处默认写sticky属性,是为了给微信和APP通过uni.createSelectorQuery查询是否支持css sticky使用
209
+ position: sticky;
210
+ /* #endif */
211
+ }
212
+ </style>
@@ -0,0 +1,49 @@
1
+ export default {
2
+ props: {
3
+ // tab的数据
4
+ list: {
5
+ type: Array,
6
+ default: uni.$u.props.subsection.list
7
+ },
8
+ // 当前活动的tab的index
9
+ current: {
10
+ type: [String, Number],
11
+ default: uni.$u.props.subsection.current
12
+ },
13
+ // 激活的颜色
14
+ activeColor: {
15
+ type: String,
16
+ default: uni.$u.props.subsection.activeColor
17
+ },
18
+ // 未激活的颜色
19
+ inactiveColor: {
20
+ type: String,
21
+ default: uni.$u.props.subsection.inactiveColor
22
+ },
23
+ // 模式选择,mode=button为按钮形式,mode=subsection时为分段模式
24
+ mode: {
25
+ type: String,
26
+ default: uni.$u.props.subsection.mode
27
+ },
28
+ // 字体大小
29
+ fontSize: {
30
+ type: [String, Number],
31
+ default: uni.$u.props.subsection.fontSize
32
+ },
33
+ // 激活tab的字体是否加粗
34
+ bold: {
35
+ type: Boolean,
36
+ default: uni.$u.props.subsection.bold
37
+ },
38
+ // mode = button时,组件背景颜色
39
+ bgColor: {
40
+ type: String,
41
+ default: uni.$u.props.subsection.bgColor
42
+ },
43
+ // 从list元素对象中读取的键名
44
+ keyName: {
45
+ type: String,
46
+ default: uni.$u.props.subsection.keyName
47
+ }
48
+ }
49
+ }