@gmcb/uv-ui 0.2.26

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 (285) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/LICENSE +21 -0
  3. package/README.md +164 -0
  4. package/components/uv-action-sheet/props.js +50 -0
  5. package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
  6. package/components/uv-album/uv-album.vue +312 -0
  7. package/components/uv-alert/props.js +45 -0
  8. package/components/uv-alert/uv-alert.vue +246 -0
  9. package/components/uv-avatar/props.js +85 -0
  10. package/components/uv-avatar/uv-avatar.vue +182 -0
  11. package/components/uv-avatar-group/props.js +53 -0
  12. package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
  13. package/components/uv-back-top/props.js +58 -0
  14. package/components/uv-back-top/uv-back-top.vue +116 -0
  15. package/components/uv-badge/props.js +73 -0
  16. package/components/uv-badge/uv-badge.vue +176 -0
  17. package/components/uv-button/nvue.scss +46 -0
  18. package/components/uv-button/props.js +163 -0
  19. package/components/uv-button/uv-button.vue +529 -0
  20. package/components/uv-button/vue.scss +93 -0
  21. package/components/uv-calendar/calendar.js +546 -0
  22. package/components/uv-calendar/header.vue +104 -0
  23. package/components/uv-calendar/month.vue +616 -0
  24. package/components/uv-calendar/props.js +145 -0
  25. package/components/uv-calendar/uv-calendar.vue +390 -0
  26. package/components/uv-calendars/calendar-body.vue +376 -0
  27. package/components/uv-calendars/calendar-item.vue +248 -0
  28. package/components/uv-calendars/calendar.js +546 -0
  29. package/components/uv-calendars/i18n/en.json +12 -0
  30. package/components/uv-calendars/i18n/index.js +8 -0
  31. package/components/uv-calendars/i18n/zh-Hans.json +12 -0
  32. package/components/uv-calendars/i18n/zh-Hant.json +12 -0
  33. package/components/uv-calendars/util.js +435 -0
  34. package/components/uv-calendars/uv-calendars.vue +452 -0
  35. package/components/uv-cell/props.js +116 -0
  36. package/components/uv-cell/uv-cell.vue +209 -0
  37. package/components/uv-cell-group/props.js +15 -0
  38. package/components/uv-cell-group/uv-cell-group.vue +63 -0
  39. package/components/uv-checkbox/props.js +70 -0
  40. package/components/uv-checkbox/uv-checkbox.vue +371 -0
  41. package/components/uv-checkbox-group/props.js +84 -0
  42. package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
  43. package/components/uv-code/props.js +35 -0
  44. package/components/uv-code/uv-code.vue +136 -0
  45. package/components/uv-code-input/props.js +83 -0
  46. package/components/uv-code-input/uv-code-input.vue +272 -0
  47. package/components/uv-col/props.js +30 -0
  48. package/components/uv-col/uv-col.vue +165 -0
  49. package/components/uv-collapse/props.js +20 -0
  50. package/components/uv-collapse/uv-collapse.vue +86 -0
  51. package/components/uv-collapse-item/props.js +60 -0
  52. package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
  53. package/components/uv-column-notice/props.js +61 -0
  54. package/components/uv-column-notice/uv-column-notice.vue +176 -0
  55. package/components/uv-count-down/props.js +25 -0
  56. package/components/uv-count-down/utils.js +62 -0
  57. package/components/uv-count-down/uv-count-down.vue +169 -0
  58. package/components/uv-count-to/props.js +60 -0
  59. package/components/uv-count-to/uv-count-to.vue +187 -0
  60. package/components/uv-datetime-picker/props.js +130 -0
  61. package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
  62. package/components/uv-divider/props.js +45 -0
  63. package/components/uv-divider/uv-divider.vue +113 -0
  64. package/components/uv-drop-down/uv-drop-down.vue +135 -0
  65. package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
  66. package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
  67. package/components/uv-empty/props.js +60 -0
  68. package/components/uv-empty/uv-empty.vue +126 -0
  69. package/components/uv-form/props.js +46 -0
  70. package/components/uv-form/uv-form.vue +209 -0
  71. package/components/uv-form/valid.js +1343 -0
  72. package/components/uv-form-item/props.js +49 -0
  73. package/components/uv-form-item/uv-form-item.vue +226 -0
  74. package/components/uv-gap/props.js +25 -0
  75. package/components/uv-gap/uv-gap.vue +36 -0
  76. package/components/uv-grid/props.js +20 -0
  77. package/components/uv-grid/uv-grid.vue +100 -0
  78. package/components/uv-grid-item/props.js +15 -0
  79. package/components/uv-grid-item/uv-grid-item.vue +223 -0
  80. package/components/uv-icon/icons.js +160 -0
  81. package/components/uv-icon/props.js +90 -0
  82. package/components/uv-icon/uv-icon.vue +226 -0
  83. package/components/uv-icon/uvicons.ttf +0 -0
  84. package/components/uv-image/props.js +100 -0
  85. package/components/uv-image/uv-image.vue +296 -0
  86. package/components/uv-index-anchor/props.js +30 -0
  87. package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
  88. package/components/uv-index-item/uv-index-item.vue +87 -0
  89. package/components/uv-index-list/props.js +30 -0
  90. package/components/uv-index-list/uv-index-list.vue +461 -0
  91. package/components/uv-input/props.js +175 -0
  92. package/components/uv-input/uv-input.vue +348 -0
  93. package/components/uv-keyboard/props.js +95 -0
  94. package/components/uv-keyboard/uv-keyboard.vue +180 -0
  95. package/components/uv-keyboard-car/props.js +24 -0
  96. package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
  97. package/components/uv-keyboard-number/props.js +19 -0
  98. package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
  99. package/components/uv-line/props.js +34 -0
  100. package/components/uv-line/uv-line.vue +60 -0
  101. package/components/uv-line-progress/props.js +29 -0
  102. package/components/uv-line-progress/uv-line-progress.vue +146 -0
  103. package/components/uv-link/props.js +40 -0
  104. package/components/uv-link/uv-link.vue +83 -0
  105. package/components/uv-list/uv-list.vue +147 -0
  106. package/components/uv-list-item/uv-list-item.vue +535 -0
  107. package/components/uv-load-more/props.js +95 -0
  108. package/components/uv-load-more/uv-load-more.vue +152 -0
  109. package/components/uv-loading-icon/props.js +67 -0
  110. package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
  111. package/components/uv-loading-page/props.js +55 -0
  112. package/components/uv-loading-page/uv-loading-page.vue +96 -0
  113. package/components/uv-modal/props.js +90 -0
  114. package/components/uv-modal/uv-modal.vue +245 -0
  115. package/components/uv-navbar/props.js +89 -0
  116. package/components/uv-navbar/uv-navbar.vue +245 -0
  117. package/components/uv-no-network/props.js +20 -0
  118. package/components/uv-no-network/uv-no-network.vue +222 -0
  119. package/components/uv-notice-bar/props.js +76 -0
  120. package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
  121. package/components/uv-notify/props.js +45 -0
  122. package/components/uv-notify/uv-notify.vue +220 -0
  123. package/components/uv-number-box/props.js +118 -0
  124. package/components/uv-number-box/uv-number-box.vue +397 -0
  125. package/components/uv-overlay/props.js +25 -0
  126. package/components/uv-overlay/uv-overlay.vue +85 -0
  127. package/components/uv-parse/node/node.vue +576 -0
  128. package/components/uv-parse/parser.js +1335 -0
  129. package/components/uv-parse/uv-parse.vue +498 -0
  130. package/components/uv-pick-color/colors.js +217 -0
  131. package/components/uv-pick-color/props.js +47 -0
  132. package/components/uv-pick-color/uv-pick-color.vue +551 -0
  133. package/components/uv-picker/props.js +95 -0
  134. package/components/uv-picker/uv-picker.vue +329 -0
  135. package/components/uv-popup/keypress.js +45 -0
  136. package/components/uv-popup/uv-popup.vue +537 -0
  137. package/components/uv-preview-video/uv-preview-video.vue +52 -0
  138. package/components/uv-qrcode/cache.js +1 -0
  139. package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
  140. package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
  141. package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
  142. package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
  143. package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
  144. package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
  145. package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
  146. package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
  147. package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
  148. package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
  149. package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
  150. package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
  151. package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
  152. package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
  153. package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
  154. package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
  155. package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
  156. package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
  157. package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
  158. package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
  159. package/components/uv-qrcode/gcanvas/env/image.js +96 -0
  160. package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
  161. package/components/uv-qrcode/gcanvas/index.js +39 -0
  162. package/components/uv-qrcode/props.js +85 -0
  163. package/components/uv-qrcode/qrcode.js +34 -0
  164. package/components/uv-qrcode/queue.js +41 -0
  165. package/components/uv-qrcode/uv-qrcode.vue +1038 -0
  166. package/components/uv-radio/props.js +65 -0
  167. package/components/uv-radio/uv-radio.vue +349 -0
  168. package/components/uv-radio-group/props.js +89 -0
  169. package/components/uv-radio-group/uv-radio-group.vue +115 -0
  170. package/components/uv-rate/props.js +73 -0
  171. package/components/uv-rate/uv-rate.vue +274 -0
  172. package/components/uv-read-more/props.js +62 -0
  173. package/components/uv-read-more/uv-read-more.vue +162 -0
  174. package/components/uv-row/props.js +20 -0
  175. package/components/uv-row/uv-row.vue +95 -0
  176. package/components/uv-row-notice/props.js +40 -0
  177. package/components/uv-row-notice/uv-row-notice.vue +341 -0
  178. package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
  179. package/components/uv-scroll-list/nvue.js +29 -0
  180. package/components/uv-scroll-list/props.js +35 -0
  181. package/components/uv-scroll-list/scrollWxs.wxs +51 -0
  182. package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
  183. package/components/uv-search/props.js +127 -0
  184. package/components/uv-search/uv-search.vue +311 -0
  185. package/components/uv-skeleton/props.js +65 -0
  186. package/components/uv-skeleton/uv-skeleton.vue +250 -0
  187. package/components/uv-skeletons/uv-skeletons.vue +247 -0
  188. package/components/uv-slider/props.js +58 -0
  189. package/components/uv-slider/uv-slider.vue +58 -0
  190. package/components/uv-status-bar/props.js +8 -0
  191. package/components/uv-status-bar/uv-status-bar.vue +54 -0
  192. package/components/uv-steps/props.js +40 -0
  193. package/components/uv-steps/uv-steps.vue +83 -0
  194. package/components/uv-steps-item/props.js +25 -0
  195. package/components/uv-steps-item/uv-steps-item.vue +347 -0
  196. package/components/uv-sticky/props.js +41 -0
  197. package/components/uv-sticky/uv-sticky.vue +223 -0
  198. package/components/uv-subsection/props.js +54 -0
  199. package/components/uv-subsection/uv-subsection.vue +269 -0
  200. package/components/uv-swipe-action/props.js +10 -0
  201. package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
  202. package/components/uv-swipe-action-item/index - backup.wxs +256 -0
  203. package/components/uv-swipe-action-item/index.wxs +225 -0
  204. package/components/uv-swipe-action-item/nvue - backup.js +264 -0
  205. package/components/uv-swipe-action-item/nvue.js +182 -0
  206. package/components/uv-swipe-action-item/props.js +40 -0
  207. package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
  208. package/components/uv-swipe-action-item/wxs.js +15 -0
  209. package/components/uv-swiper/props.js +136 -0
  210. package/components/uv-swiper/uv-swiper.vue +263 -0
  211. package/components/uv-swiper-indicator/props.js +30 -0
  212. package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
  213. package/components/uv-switch/props.js +58 -0
  214. package/components/uv-switch/uv-switch.vue +182 -0
  215. package/components/uv-tabbar/props.js +50 -0
  216. package/components/uv-tabbar/uv-tabbar.vue +146 -0
  217. package/components/uv-tabbar-item/props.js +40 -0
  218. package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
  219. package/components/uv-tabs/props.js +71 -0
  220. package/components/uv-tabs/uv-tabs.vue +391 -0
  221. package/components/uv-tags/props.js +104 -0
  222. package/components/uv-tags/uv-tags.vue +379 -0
  223. package/components/uv-text/props.js +113 -0
  224. package/components/uv-text/uv-text.vue +218 -0
  225. package/components/uv-text/value.js +87 -0
  226. package/components/uv-textarea/props.js +138 -0
  227. package/components/uv-textarea/uv-textarea.vue +238 -0
  228. package/components/uv-toast/uv-toast.vue +292 -0
  229. package/components/uv-toolbar/props.js +40 -0
  230. package/components/uv-toolbar/uv-toolbar.vue +109 -0
  231. package/components/uv-tooltip/props.js +60 -0
  232. package/components/uv-tooltip/uv-tooltip.vue +372 -0
  233. package/components/uv-transition/createAnimation.js +131 -0
  234. package/components/uv-transition/props.js +31 -0
  235. package/components/uv-transition/uv-transition.vue +320 -0
  236. package/components/uv-upload/mixin.js +22 -0
  237. package/components/uv-upload/props.js +130 -0
  238. package/components/uv-upload/utils.js +151 -0
  239. package/components/uv-upload/uv-upload.vue +488 -0
  240. package/components/uv-vtabs/props.js +79 -0
  241. package/components/uv-vtabs/uv-vtabs.vue +438 -0
  242. package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
  243. package/components/uv-waterfall/props.js +69 -0
  244. package/components/uv-waterfall/uv-waterfall.vue +265 -0
  245. package/index.js +82 -0
  246. package/index.scss +7 -0
  247. package/libs/config/config.js +34 -0
  248. package/libs/css/color.scss +32 -0
  249. package/libs/css/common.scss +100 -0
  250. package/libs/css/components.scss +23 -0
  251. package/libs/css/variable.scss +111 -0
  252. package/libs/css/vue.scss +40 -0
  253. package/libs/function/colorGradient.js +134 -0
  254. package/libs/function/compress.js +27 -0
  255. package/libs/function/debounce.js +29 -0
  256. package/libs/function/digit.js +167 -0
  257. package/libs/function/index.js +734 -0
  258. package/libs/function/platform.js +75 -0
  259. package/libs/function/test.js +287 -0
  260. package/libs/function/throttle.js +30 -0
  261. package/libs/luch-request/adapters/index.js +132 -0
  262. package/libs/luch-request/core/InterceptorManager.js +51 -0
  263. package/libs/luch-request/core/Request.js +201 -0
  264. package/libs/luch-request/core/buildFullPath.js +20 -0
  265. package/libs/luch-request/core/defaults.js +33 -0
  266. package/libs/luch-request/core/dispatchRequest.js +6 -0
  267. package/libs/luch-request/core/mergeConfig.js +126 -0
  268. package/libs/luch-request/core/settle.js +16 -0
  269. package/libs/luch-request/helpers/buildURL.js +64 -0
  270. package/libs/luch-request/helpers/combineURLs.js +14 -0
  271. package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
  272. package/libs/luch-request/index.d.ts +197 -0
  273. package/libs/luch-request/index.js +2 -0
  274. package/libs/luch-request/utils/clone.js +264 -0
  275. package/libs/luch-request/utils.js +135 -0
  276. package/libs/mixin/button.js +13 -0
  277. package/libs/mixin/mixin.js +172 -0
  278. package/libs/mixin/mpMixin.js +8 -0
  279. package/libs/mixin/mpShare.js +13 -0
  280. package/libs/mixin/openType.js +47 -0
  281. package/libs/mixin/touch.js +59 -0
  282. package/libs/util/dayjs.js +216 -0
  283. package/libs/util/route.js +126 -0
  284. package/package.json +28 -0
  285. package/theme.scss +43 -0
@@ -0,0 +1,371 @@
1
+ <template>
2
+ <view
3
+ class="uv-checkbox"
4
+ :style="[checkboxStyle]"
5
+ @tap.stop="wrapperClickHandler"
6
+ :class="[`uv-checkbox-label--${parentData.iconPlacement}`, parentData.borderBottom && parentData.placement === 'column' && 'uv-border-bottom']"
7
+ >
8
+ <view
9
+ class="uv-checkbox__icon-wrap"
10
+ @tap.stop="iconClickHandler"
11
+ :class="iconClasses"
12
+ :style="[iconWrapStyle]"
13
+ >
14
+ <slot name="icon">
15
+ <uv-icon
16
+ class="uv-checkbox__icon-wrap__icon"
17
+ name="checkbox-mark"
18
+ :size="elIconSize"
19
+ :color="elIconColor"
20
+ />
21
+ </slot>
22
+ </view>
23
+ <view
24
+ v-if="label !== false"
25
+ class="uv-checkbox__label-wrap"
26
+ @tap.stop="labelClickHandler">
27
+ <slot>
28
+ <text
29
+ :style="{
30
+ color: elDisabled ? elInactiveColor : elLabelColor,
31
+ fontSize: elLabelSize,
32
+ lineHeight: elLabelSize
33
+ }"
34
+ >{{label}}</text>
35
+ </slot>
36
+ </view>
37
+
38
+ </view>
39
+ </template>
40
+
41
+ <script>
42
+ import mpMixin from '../../libs/mixin/mpMixin.js'
43
+ import mixin from '../../libs/mixin/mixin.js'
44
+ import props from './props.js';
45
+ /**
46
+ * checkbox 复选框
47
+ * @description 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便
48
+ * @tutorial https://www.uvui.cn/components/checkbox.html
49
+ * @property {String | Number | Boolean} name checkbox组件的标示符
50
+ * @property {String} shape 形状,square为方形,circle为圆型
51
+ * @property {String | Number} size 整体的大小
52
+ * @property {Boolean} checked 是否默认选中
53
+ * @property {String | Boolean} disabled 是否禁用
54
+ * @property {String} activeColor 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值
55
+ * @property {String} inactiveColor 未选中的颜色
56
+ * @property {String | Number} iconSize 图标的大小,单位px
57
+ * @property {String} iconColor 图标颜色
58
+ * @property {String | Number} label label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式
59
+ * @property {String} labelColor label的颜色
60
+ * @property {String | Number} labelSize label的字体大小,px单位
61
+ * @property {String | Boolean} labelDisabled 是否禁止点击提示语选中复选框
62
+ * @property {Object} customStyle 定义需要用到的外部样式
63
+ *
64
+ * @event {Function} change 任一个checkbox状态发生变化时触发,回调为一个对象
65
+ * @example <uv-checkbox v-model="checked" :disabled="false">天涯</uv-checkbox>
66
+ */
67
+ export default {
68
+ name: "uv-checkbox",
69
+ mixins: [mpMixin, mixin, props],
70
+ data() {
71
+ return {
72
+ isChecked: false,
73
+ // 父组件的默认值,因为头条小程序不支持在computed中使用this.parent.shape的形式
74
+ // 故只能使用如此方法
75
+ parentData: {
76
+ iconSize: 12,
77
+ labelDisabled: null,
78
+ disabled: null,
79
+ shape: 'square',
80
+ activeColor: null,
81
+ inactiveColor: null,
82
+ size: 18,
83
+ value: null,
84
+ modelValue: null,
85
+ iconColor: null,
86
+ placement: 'row',
87
+ borderBottom: false,
88
+ iconPlacement: 'left',
89
+ labelSize: 14,
90
+ labelColor: '#303133'
91
+ }
92
+ }
93
+ },
94
+ computed: {
95
+ // 是否禁用,如果父组件uv-raios-group禁用的话,将会忽略子组件的配置
96
+ elDisabled() {
97
+ return this.disabled !== '' ? this.disabled : this.parentData.disabled !== null ? this.parentData.disabled : false;
98
+ },
99
+ // 是否禁用label点击
100
+ elLabelDisabled() {
101
+ return this.labelDisabled !== '' ? this.labelDisabled : this.parentData.labelDisabled !== null ? this.parentData.labelDisabled :
102
+ false;
103
+ },
104
+ // 组件尺寸,对应size的值,默认值为21px
105
+ elSize() {
106
+ return this.size ? this.size : (this.parentData.size ? this.parentData.size : 21);
107
+ },
108
+ // 组件的勾选图标的尺寸,默认12px
109
+ elIconSize() {
110
+ return this.iconSize ? this.iconSize : (this.parentData.iconSize ? this.parentData.iconSize : 12);
111
+ },
112
+ // 组件选中激活时的颜色
113
+ elActiveColor() {
114
+ return this.activeColor ? this.activeColor : (this.parentData.activeColor ? this.parentData.activeColor : '#2979ff');
115
+ },
116
+ // 组件选未中激活时的颜色
117
+ elInactiveColor() {
118
+ return this.inactiveColor ? this.inactiveColor : (this.parentData.inactiveColor ? this.parentData.inactiveColor :
119
+ '#c8c9cc');
120
+ },
121
+ // label的颜色
122
+ elLabelColor() {
123
+ return this.labelColor ? this.labelColor : (this.parentData.labelColor ? this.parentData.labelColor : '#606266')
124
+ },
125
+ // 组件的形状
126
+ elShape() {
127
+ return this.shape ? this.shape : (this.parentData.shape ? this.parentData.shape : 'circle');
128
+ },
129
+ // label大小
130
+ elLabelSize() {
131
+ return this.$uv.addUnit(this.labelSize ? this.labelSize : (this.parentData.labelSize ? this.parentData.labelSize :
132
+ '15'))
133
+ },
134
+ elIconColor() {
135
+ const iconColor = this.iconColor ? this.iconColor : (this.parentData.iconColor ? this.parentData.iconColor :
136
+ '#ffffff');
137
+ // 图标的颜色
138
+ if (this.elDisabled) {
139
+ // disabled状态下,已勾选的checkbox图标改为elInactiveColor
140
+ return this.isChecked ? this.elInactiveColor : 'transparent'
141
+ } else {
142
+ return this.isChecked ? iconColor : 'transparent'
143
+ }
144
+ },
145
+ iconClasses() {
146
+ let classes = []
147
+ // 组件的形状
148
+ classes.push('uv-checkbox__icon-wrap--' + this.elShape)
149
+ if (this.elDisabled) {
150
+ classes.push('uv-checkbox__icon-wrap--disabled')
151
+ }
152
+ if (this.isChecked && this.elDisabled) {
153
+ classes.push('uv-checkbox__icon-wrap--disabled--checked')
154
+ }
155
+ // 支付宝,头条小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效
156
+ // #ifdef MP-ALIPAY || MP-TOUTIAO
157
+ classes = classes.join(' ')
158
+ // #endif
159
+ return classes
160
+ },
161
+ iconWrapStyle() {
162
+ // checkbox的整体样式
163
+ const style = {}
164
+ style.backgroundColor = this.isChecked && !this.elDisabled ? this.elActiveColor : '#ffffff'
165
+ style.borderColor = this.isChecked && !this.elDisabled ? this.elActiveColor : this.elInactiveColor
166
+ style.width = this.$uv.addUnit(this.elSize)
167
+ style.height = this.$uv.addUnit(this.elSize)
168
+ // 如果是图标在右边的话,移除它的右边距
169
+ if (this.parentData.iconPlacement === 'right') {
170
+ style.marginRight = 0
171
+ }
172
+ return style
173
+ },
174
+ checkboxStyle() {
175
+ const style = {}
176
+ if (this.parentData.borderBottom && this.parentData.placement === 'row') {
177
+ this.$uv.error('检测到您将borderBottom设置为true,需要同时将uv-checkbox-group的placement设置为column才有效')
178
+ }
179
+ // 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
180
+ if (this.parentData.borderBottom && this.parentData.placement === 'column') {
181
+ style.paddingBottom = '8px'
182
+ }
183
+ return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
184
+ }
185
+ },
186
+ created() {
187
+ this.init()
188
+ },
189
+ methods: {
190
+ init() {
191
+ // 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环引用
192
+ this.updateParentData()
193
+ if (!this.parent) {
194
+ this.$uv.error('uv-checkbox必须搭配uv-checkbox-group组件使用')
195
+ }
196
+ this.$nextTick(()=>{
197
+ let parentValue = [];
198
+ if(this.parentData.value.length) {
199
+ parentValue = this.parentData.value;
200
+ } else if (this.parentData.modelValue.length){
201
+ parentValue = this.parentData.modelValue;
202
+ }
203
+ // 设置初始化时,是否默认选中的状态,父组件uv-checkbox-group的value可能是array,所以额外判断
204
+ if (this.checked) {
205
+ this.isChecked = true
206
+ } else if (this.$uv.test.array(parentValue)) {
207
+ // 查找数组是是否存在this.name元素值
208
+ this.isChecked = parentValue.some(item => {
209
+ return item === this.name
210
+ })
211
+ }
212
+ })
213
+ },
214
+ updateParentData() {
215
+ this.getParentData('uv-checkbox-group')
216
+ },
217
+ // 横向两端排列时,点击组件即可触发选中事件
218
+ wrapperClickHandler(e) {
219
+ this.parentData.iconPlacement === 'right' && this.iconClickHandler(e)
220
+ },
221
+ // 点击图标
222
+ iconClickHandler(e) {
223
+ this.preventEvent(e)
224
+ // 如果整体被禁用,不允许被点击
225
+ if (!this.elDisabled) {
226
+ this.setRadioCheckedStatus()
227
+ }
228
+ },
229
+ // 点击label
230
+ labelClickHandler(e) {
231
+ this.preventEvent(e)
232
+ // 如果按钮整体被禁用或者label被禁用,则不允许点击文字修改状态
233
+ if (!this.elLabelDisabled && !this.elDisabled) {
234
+ this.setRadioCheckedStatus()
235
+ }
236
+ },
237
+ emitEvent() {
238
+ this.$emit('change', this.isChecked)
239
+ // 尝试调用uv-form的验证方法,进行一定延迟,否则微信小程序更新可能会不及时
240
+ this.$nextTick(() => {
241
+ this.$uv.formValidate(this, 'change')
242
+ })
243
+ },
244
+ // 改变组件选中状态
245
+ // 这里的改变的依据是,更改本组件的checked值为true,同时通过父组件遍历所有uv-checkbox实例
246
+ // 将本组件外的其他uv-checkbox的checked都设置为false(都被取消选中状态),因而只剩下一个为选中状态
247
+ setRadioCheckedStatus() {
248
+ // 将本组件标记为与原来相反的状态
249
+ this.isChecked = !this.isChecked
250
+ this.emitEvent()
251
+ typeof this.parent.unCheckedOther === 'function' && this.parent.unCheckedOther(this)
252
+ }
253
+ },
254
+ watch:{
255
+ checked(){
256
+ this.isChecked = this.checked
257
+ }
258
+ }
259
+ }
260
+ </script>
261
+
262
+ <style lang="scss" scoped>
263
+ $show-border: 1;
264
+ $show-border-bottom: 1;
265
+ @import '../../libs/css/variable.scss';
266
+ @import '../../libs/css/components.scss';
267
+ @import '../../libs/css/color.scss';
268
+ $uv-checkbox-label-wrap-padding-right:6px !default;
269
+ $uv-checkbox-icon-wrap-font-size:6px !default;
270
+ $uv-checkbox-icon-wrap-border-width:1px !default;
271
+ $uv-checkbox-icon-wrap-border-color:#c8c9cc !default;
272
+ $uv-checkbox-icon-wrap-icon-line-height:0 !default;
273
+ $uv-checkbox-icon-wrap-circle-border-radius:100% !default;
274
+ $uv-checkbox-icon-wrap-square-border-radius:3px !default;
275
+ $uv-checkbox-icon-wrap-checked-color:#fff !default;
276
+ $uv-checkbox-icon-wrap-checked-background-color:red !default;
277
+ $uv-checkbox-icon-wrap-checked-border-color:#2979ff !default;
278
+ $uv-checkbox-icon-wrap-disabled-background-color:#ebedf0 !default;
279
+ $uv-checkbox-icon-wrap-disabled-checked-color:#c8c9cc !default;
280
+ $uv-checkbox-label-margin-left:5px !default;
281
+ $uv-checkbox-label-margin-right:12px !default;
282
+ $uv-checkbox-label-color:$uv-content-color !default;
283
+ $uv-checkbox-label-font-size:15px !default;
284
+ $uv-checkbox-label-disabled-color:#c8c9cc !default;
285
+
286
+ .uv-checkbox {
287
+ /* #ifndef APP-NVUE */
288
+ @include flex(row);
289
+ /* #endif */
290
+ overflow: hidden;
291
+ flex-direction: row;
292
+ align-items: center;
293
+
294
+ &-label--left {
295
+ flex-direction: row
296
+ }
297
+
298
+ &-label--right {
299
+ flex-direction: row-reverse;
300
+ justify-content: space-between
301
+ }
302
+
303
+ &__icon-wrap {
304
+ /* #ifndef APP-NVUE */
305
+ box-sizing: border-box;
306
+ // nvue下,border-color过渡有问题
307
+ transition-property: border-color, background-color, color;
308
+ transition-duration: 0.2s;
309
+ /* #endif */
310
+ color: $uv-content-color;
311
+ @include flex;
312
+ align-items: center;
313
+ justify-content: center;
314
+ color: transparent;
315
+ text-align: center;
316
+ font-size: $uv-checkbox-icon-wrap-font-size;
317
+ border-width: $uv-checkbox-icon-wrap-border-width;
318
+ border-color: $uv-checkbox-icon-wrap-border-color;
319
+ border-style: solid;
320
+
321
+ /* #ifdef MP-TOUTIAO */
322
+ // 头条小程序兼容性问题,需要设置行高为0,否则图标偏下
323
+ &__icon {
324
+ line-height: $uv-checkbox-icon-wrap-icon-line-height;
325
+ }
326
+
327
+ /* #endif */
328
+
329
+ &--circle {
330
+ border-radius: $uv-checkbox-icon-wrap-circle-border-radius;
331
+ }
332
+
333
+ &--square {
334
+ border-radius: $uv-checkbox-icon-wrap-square-border-radius;
335
+ }
336
+
337
+ &--checked {
338
+ color: $uv-checkbox-icon-wrap-checked-color;
339
+ background-color: $uv-checkbox-icon-wrap-checked-background-color;
340
+ border-color: $uv-checkbox-icon-wrap-checked-border-color;
341
+ }
342
+
343
+ &--disabled {
344
+ background-color: $uv-checkbox-icon-wrap-disabled-background-color !important;
345
+ }
346
+
347
+ &--disabled--checked {
348
+ color: $uv-checkbox-icon-wrap-disabled-checked-color !important;
349
+ }
350
+ }
351
+
352
+ &__label {
353
+ /* #ifndef APP-NVUE */
354
+ word-wrap: break-word;
355
+ /* #endif */
356
+ margin-left: $uv-checkbox-label-margin-left;
357
+ margin-right: $uv-checkbox-label-margin-right;
358
+ color: $uv-checkbox-label-color;
359
+ font-size: $uv-checkbox-label-font-size;
360
+
361
+ &--disabled {
362
+ color: $uv-checkbox-label-disabled-color;
363
+ }
364
+ }
365
+
366
+ &__label-wrap {
367
+ flex: 1;
368
+ padding-left: $uv-checkbox-label-wrap-padding-right;
369
+ }
370
+ }
371
+ </style>
@@ -0,0 +1,84 @@
1
+ export default {
2
+ props: {
3
+ // 绑定的值
4
+ value: {
5
+ type: Array,
6
+ default: () => []
7
+ },
8
+ modelValue: {
9
+ type: Array,
10
+ default: () => []
11
+ },
12
+ // 标识符
13
+ name: {
14
+ type: String,
15
+ default: ''
16
+ },
17
+ // 形状,circle-圆形,square-方形
18
+ shape: {
19
+ type: String,
20
+ default: 'square'
21
+ },
22
+ // 是否禁用全部checkbox
23
+ disabled: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ // 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值
28
+ activeColor: {
29
+ type: String,
30
+ default: '#2979ff'
31
+ },
32
+ // 未选中的颜色
33
+ inactiveColor: {
34
+ type: String,
35
+ default: '#c8c9cc'
36
+ },
37
+ // 整个组件的尺寸,默认px
38
+ size: {
39
+ type: [String, Number],
40
+ default: 18
41
+ },
42
+ // 布局方式,row-横向,column-纵向
43
+ placement: {
44
+ type: String,
45
+ default: 'row'
46
+ },
47
+ // label的字体大小,px单位
48
+ labelSize: {
49
+ type: [String, Number],
50
+ default: 14
51
+ },
52
+ // label的字体颜色
53
+ labelColor: {
54
+ type: [String],
55
+ default: '#303133'
56
+ },
57
+ // 是否禁止点击文本操作
58
+ labelDisabled: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ // 图标颜色
63
+ iconColor: {
64
+ type: String,
65
+ default: '#fff'
66
+ },
67
+ // 图标的大小,单位px
68
+ iconSize: {
69
+ type: [String, Number],
70
+ default: 12
71
+ },
72
+ // 勾选图标的对齐方式,left-左边,right-右边
73
+ iconPlacement: {
74
+ type: String,
75
+ default: 'left'
76
+ },
77
+ // 竖向配列时,是否显示下划线
78
+ borderBottom: {
79
+ type: Boolean,
80
+ default: false
81
+ },
82
+ ...uni.$uv?.props?.checkboxGroup
83
+ }
84
+ }
@@ -0,0 +1,119 @@
1
+ <template>
2
+ <view
3
+ class="uv-checkbox-group"
4
+ :class="bemClass"
5
+ :style="[$uv.addStyle(this.customStyle)]"
6
+ >
7
+ <slot></slot>
8
+ </view>
9
+ </template>
10
+
11
+ <script>
12
+ import mpMixin from '../../libs/mixin/mpMixin.js'
13
+ import mixin from '../../libs/mixin/mixin.js'
14
+ import props from './props.js';
15
+ /**
16
+ * checkboxGroup 复选框组
17
+ * @description 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便
18
+ * @tutorial https://www.uvui.cn/components/checkbox.html
19
+ * @property {String} name 标识符
20
+ * @property {Array} value 绑定的值
21
+ * @property {String} shape 形状,circle-圆形,square-方形 (默认 'square' )
22
+ * @property {Boolean} disabled 是否禁用全部checkbox (默认 false )
23
+ * @property {String} activeColor 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 (默认 '#2979ff' )
24
+ * @property {String} inactiveColor 未选中的颜色 (默认 '#c8c9cc' )
25
+ * @property {String | Number} size 整个组件的尺寸 单位px (默认 18 )
26
+ * @property {String} placement 布局方式,row-横向,column-纵向 (默认 'row' )
27
+ * @property {String | Number} labelSize label的字体大小,px单位 (默认 14 )
28
+ * @property {String} labelColor label的字体颜色 (默认 '#303133' )
29
+ * @property {Boolean} labelDisabled 是否禁止点击文本操作 (默认 false )
30
+ * @property {String} iconColor 图标颜色 (默认 '#ffffff' )
31
+ * @property {String | Number} iconSize 图标的大小,单位px (默认 12 )
32
+ * @property {String} iconPlacement 勾选图标的对齐方式,left-左边,right-右边 (默认 'left' )
33
+ * @property {Boolean} borderBottom placement为row时,是否显示下边框 (默认 false )
34
+ * @event {Function} change 任一个checkbox状态发生变化时触发,回调为一个对象
35
+ * @event {Function} input 修改通过v-model绑定的值时触发,回调为一个对象
36
+ * @example <uv-checkbox-group></uv-checkbox-group>
37
+ */
38
+ export default {
39
+ name: 'uv-checkbox-group',
40
+ mixins: [mpMixin, mixin, props],
41
+ computed: {
42
+ // 这里computed的变量,都是子组件uv-checkbox需要用到的,由于头条小程序的兼容性差异,子组件无法实时监听父组件参数的变化
43
+ // 所以需要手动通知子组件,这里返回一个parentData变量,供watch监听,在其中去通知每一个子组件重新从父组件(uv-checkbox-group)
44
+ // 拉取父组件新的变化后的参数
45
+ parentData() {
46
+ let value = [];
47
+ if(this.value.length) {
48
+ value = this.value;
49
+ } else if (this.modelValue.length){
50
+ value = this.modelValue;
51
+ }
52
+ return [value, this.disabled, this.inactiveColor, this.activeColor, this.size, this.labelDisabled, this.shape,
53
+ this.iconSize, this.borderBottom, this.placement, this.labelSize, this.labelColor]
54
+ },
55
+ bemClass() {
56
+ // this.bem为一个computed变量,在mixin中
57
+ return this.bem('checkbox-group', ['placement'])
58
+ },
59
+ },
60
+ watch: {
61
+ // 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
62
+ parentData() {
63
+ if (this.children.length) {
64
+ this.children.map(child => {
65
+ // 判断子组件(uv-checkbox)如果有init方法的话,就就执行(执行的结果是子组件重新从父组件拉取了最新的值)
66
+ typeof(child.init) === 'function' && child.init()
67
+ })
68
+ }
69
+ },
70
+ },
71
+ data() {
72
+ return {
73
+
74
+ }
75
+ },
76
+ created() {
77
+ this.children = []
78
+ },
79
+ methods: {
80
+ // 将其他的checkbox设置为未选中的状态
81
+ unCheckedOther(childInstance) {
82
+ const values = []
83
+ this.children.map(child => {
84
+ // 将被选中的checkbox,放到数组中返回
85
+ if (child.isChecked) {
86
+ values.push(child.name)
87
+ }
88
+ })
89
+ // 修改通过v-model绑定的值
90
+ // #ifdef VUE2
91
+ this.$emit('input', values)
92
+ // #endif
93
+ // #ifdef VUE3
94
+ this.$emit('update:modelValue',values)
95
+ // #endif
96
+ // 发出事件
97
+ this.$emit('change', values)
98
+ }
99
+ }
100
+ }
101
+ </script>
102
+
103
+ <style lang="scss" scoped>
104
+ @import '../../libs/css/components.scss';
105
+ @import '../../libs/css/color.scss';
106
+
107
+ .uv-checkbox-group {
108
+ flex: 1;
109
+
110
+ &--row {
111
+ @include flex;
112
+ flex-wrap: wrap;
113
+ }
114
+
115
+ &--column {
116
+ @include flex(column);
117
+ }
118
+ }
119
+ </style>
@@ -0,0 +1,35 @@
1
+ export default {
2
+ props: {
3
+ // 倒计时总秒数
4
+ seconds: {
5
+ type: [String, Number],
6
+ default: 60
7
+ },
8
+ // 尚未开始时提示
9
+ startText: {
10
+ type: String,
11
+ default: '获取验证码'
12
+ },
13
+ // 正在倒计时中的提示
14
+ changeText: {
15
+ type: String,
16
+ default: 'X秒重新获取'
17
+ },
18
+ // 倒计时结束时的提示
19
+ endText: {
20
+ type: String,
21
+ default: '重新获取'
22
+ },
23
+ // 是否在H5刷新或各端返回再进入时继续倒计时
24
+ keepRunning: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ // 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了
29
+ uniqueKey: {
30
+ type: String,
31
+ default: ''
32
+ },
33
+ ...uni.$uv?.props?.code
34
+ }
35
+ }