hy-app 0.1.1 → 0.1.3

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 (264) hide show
  1. package/README.md +1 -1
  2. package/api/http.ts +8 -8
  3. package/components/dialog/index.ts +2 -2
  4. package/components/hy-address-picker/hy-address-picker.vue +14 -42
  5. package/components/hy-address-picker/index.scss +27 -0
  6. package/components/hy-address-picker/props.ts +2 -3
  7. package/components/hy-address-picker/typing.d.ts +1 -2
  8. package/components/hy-avatar/hy-avatar.vue +10 -54
  9. package/components/hy-avatar/index.scss +45 -0
  10. package/components/hy-avatar/props.ts +2 -2
  11. package/components/hy-avatar/typing.d.ts +2 -2
  12. package/components/hy-back-top/hy-back-top.vue +7 -22
  13. package/components/hy-back-top/index.scss +16 -0
  14. package/components/hy-back-top/props.ts +4 -4
  15. package/components/hy-back-top/typing.d.ts +2 -3
  16. package/components/hy-badge/hy-badge.vue +5 -75
  17. package/components/hy-badge/index.scss +72 -0
  18. package/components/hy-badge/props.ts +2 -2
  19. package/components/hy-badge/typing.d.ts +2 -2
  20. package/components/hy-button/hy-button.vue +22 -134
  21. package/components/hy-button/index.scss +116 -0
  22. package/components/hy-button/props.ts +4 -5
  23. package/components/hy-button/typing.d.ts +3 -3
  24. package/components/hy-calendar/header.vue +76 -0
  25. package/components/hy-calendar/hy-calendar.vue +366 -0
  26. package/components/hy-calendar/index.scss +171 -0
  27. package/components/hy-calendar/month.vue +524 -0
  28. package/components/hy-calendar/props.ts +37 -0
  29. package/components/hy-calendar/typing.d.ts +126 -0
  30. package/components/hy-card/hy-card.vue +21 -84
  31. package/components/hy-card/index.scss +57 -0
  32. package/components/hy-card/props.ts +2 -2
  33. package/components/hy-card/typing.d.ts +1 -1
  34. package/components/hy-cell/hy-cell.vue +30 -131
  35. package/components/hy-cell/index.scss +137 -0
  36. package/components/hy-cell/props.ts +2 -2
  37. package/components/hy-cell/typing.d.ts +4 -3
  38. package/components/hy-check-button/hy-check-button.vue +14 -7
  39. package/components/hy-check-button/index.scss +5 -0
  40. package/components/hy-check-button/props.ts +3 -3
  41. package/components/hy-checkbox/hy-checkbox.vue +24 -107
  42. package/components/hy-checkbox/index.scss +94 -0
  43. package/components/hy-checkbox/props.ts +4 -5
  44. package/components/hy-checkbox/typing.d.ts +3 -7
  45. package/components/hy-count-down/hy-count-down.vue +150 -0
  46. package/components/hy-count-down/index.scss +6 -0
  47. package/components/hy-count-down/index.ts +52 -0
  48. package/components/hy-count-down/props.ts +10 -0
  49. package/components/hy-count-down/typing.d.ts +20 -0
  50. package/components/hy-count-to/hy-count-to.vue +213 -0
  51. package/components/hy-count-to/index.scss +6 -0
  52. package/components/hy-count-to/props.ts +17 -0
  53. package/components/hy-count-to/typing.d.ts +48 -0
  54. package/components/hy-datetime-picker/hy-datetime-picker.vue +38 -64
  55. package/components/hy-datetime-picker/index.scss +28 -0
  56. package/components/hy-datetime-picker/props.ts +2 -2
  57. package/components/hy-datetime-picker/typing.d.ts +1 -1
  58. package/components/hy-divider/hy-divider.vue +24 -49
  59. package/components/hy-divider/index.scss +25 -0
  60. package/components/hy-divider/props.ts +2 -2
  61. package/components/hy-divider/typing.d.ts +1 -1
  62. package/components/hy-dropdown/hy-dropdown.vue +43 -0
  63. package/components/hy-dropdown/index.scss +17 -0
  64. package/components/hy-dropdown/props.ts +17 -0
  65. package/components/hy-dropdown/typing.d.ts +48 -0
  66. package/components/hy-dropdown-item/hy-dropdown-item.vue +194 -0
  67. package/components/hy-dropdown-item/index.scss +96 -0
  68. package/components/hy-dropdown-item/props.ts +10 -0
  69. package/components/hy-dropdown-item/typing.d.ts +31 -0
  70. package/components/hy-empty/hy-empty.vue +8 -26
  71. package/components/hy-empty/index.scss +19 -0
  72. package/components/hy-empty/props.ts +2 -2
  73. package/components/hy-empty/typing.d.ts +1 -1
  74. package/components/hy-float-button/hy-float-button.vue +201 -0
  75. package/components/hy-float-button/index.scss +69 -0
  76. package/components/hy-float-button/props.ts +25 -0
  77. package/components/hy-float-button/typing.d.ts +93 -0
  78. package/components/hy-folding-panel/hy-folding-panel.vue +9 -12
  79. package/components/hy-folding-panel/index.scss +6 -0
  80. package/components/hy-folding-panel/props.ts +2 -2
  81. package/components/hy-folding-panel/typing.d.ts +2 -2
  82. package/components/hy-form/hy-form.vue +22 -39
  83. package/components/hy-form/index.scss +30 -0
  84. package/components/hy-form/props.ts +4 -2
  85. package/components/hy-form/typing.d.ts +10 -2
  86. package/components/hy-grid/hy-grid.vue +4 -45
  87. package/components/hy-grid/index.scss +40 -0
  88. package/components/hy-grid/props.ts +5 -5
  89. package/components/hy-grid/typing.d.ts +2 -2
  90. package/components/hy-icon/hy-icon.vue +7 -97
  91. package/components/hy-icon/index.scss +84 -0
  92. package/components/hy-icon/props.ts +5 -5
  93. package/components/hy-image/hy-image.vue +212 -0
  94. package/components/hy-image/index.scss +26 -0
  95. package/components/hy-image/props.ts +24 -0
  96. package/components/hy-image/typing.d.ts +76 -0
  97. package/components/hy-input/hy-input.vue +11 -82
  98. package/components/hy-input/index.scss +65 -0
  99. package/components/hy-input/props.ts +2 -2
  100. package/components/hy-input/typing.d.ts +2 -2
  101. package/components/hy-line/hy-line.vue +4 -8
  102. package/components/hy-line/index.scss +5 -0
  103. package/components/hy-line/props.ts +3 -3
  104. package/components/hy-line/typing.d.ts +2 -2
  105. package/components/hy-line-progress/hy-line-progress.vue +15 -44
  106. package/components/hy-line-progress/index.scss +38 -0
  107. package/components/hy-line-progress/props.ts +2 -2
  108. package/components/hy-line-progress/typing.d.ts +1 -1
  109. package/components/hy-list/hy-list.vue +11 -41
  110. package/components/hy-list/index.scss +32 -0
  111. package/components/hy-list/props.ts +2 -2
  112. package/components/hy-loading/hy-loading.vue +95 -0
  113. package/components/hy-loading/index.scss +103 -0
  114. package/components/hy-loading/props.ts +17 -0
  115. package/components/hy-loading/typing.d.ts +52 -0
  116. package/components/hy-login/TheUserLogin.vue +16 -16
  117. package/components/hy-login/hy-login.vue +9 -9
  118. package/components/hy-login/props.ts +4 -4
  119. package/components/hy-modal/hy-modal.vue +11 -89
  120. package/components/hy-modal/index.scss +77 -0
  121. package/components/hy-modal/props.ts +2 -2
  122. package/components/hy-modal/typing.d.ts +1 -1
  123. package/components/hy-navbar/hy-navbar.vue +20 -92
  124. package/components/hy-navbar/index.scss +67 -0
  125. package/components/hy-navbar/props.ts +2 -2
  126. package/components/hy-navbar/typing.d.ts +1 -1
  127. package/components/hy-notice-bar/hy-column-notice.vue +11 -39
  128. package/components/hy-notice-bar/hy-notice-bar.vue +10 -12
  129. package/components/hy-notice-bar/hy-row-notice.vue +5 -56
  130. package/components/hy-notice-bar/index.scss +93 -0
  131. package/components/hy-notice-bar/props.ts +4 -2
  132. package/components/hy-notice-bar/typing.d.ts +13 -3
  133. package/components/hy-number-step/hy-number-step.vue +55 -105
  134. package/components/hy-number-step/index.scss +71 -0
  135. package/components/hy-number-step/props.ts +2 -2
  136. package/components/hy-number-step/typing.d.ts +1 -1
  137. package/components/hy-overlay/hy-overlay.vue +5 -17
  138. package/components/hy-overlay/index.scss +9 -0
  139. package/components/hy-overlay/props.ts +2 -2
  140. package/components/hy-overlay/typing.d.ts +1 -1
  141. package/components/hy-picker/hy-picker.vue +21 -87
  142. package/components/hy-picker/index.scss +68 -0
  143. package/components/hy-picker/props.ts +3 -2
  144. package/components/hy-picker/typing.d.ts +5 -1
  145. package/components/hy-popup/hy-popup.vue +7 -80
  146. package/components/hy-popup/index.scss +60 -0
  147. package/components/hy-popup/props.ts +2 -2
  148. package/components/hy-popup/typing.d.ts +1 -1
  149. package/components/hy-price/hy-price.vue +5 -15
  150. package/components/hy-price/index.scss +11 -0
  151. package/components/hy-price/props.ts +2 -2
  152. package/components/hy-price/typing.d.ts +1 -1
  153. package/components/hy-qrcode/hy-qrcode.vue +15 -37
  154. package/components/hy-qrcode/index.scss +23 -0
  155. package/components/hy-qrcode/props.ts +2 -2
  156. package/components/hy-qrcode/typing.d.ts +2 -2
  157. package/components/hy-radio/hy-radio.vue +27 -113
  158. package/components/hy-radio/index.scss +93 -0
  159. package/components/hy-radio/props.ts +4 -4
  160. package/components/hy-radio/typing.d.ts +2 -2
  161. package/components/hy-rate/hy-rate.vue +33 -53
  162. package/components/hy-rate/index.scss +33 -0
  163. package/components/hy-rate/props.ts +4 -3
  164. package/components/hy-rate/typing.d.ts +1 -1
  165. package/components/hy-read-more/hy-read-more.vue +7 -30
  166. package/components/hy-read-more/index.scss +25 -0
  167. package/components/hy-read-more/props.ts +3 -3
  168. package/components/hy-read-more/typing.d.ts +1 -1
  169. package/components/hy-safe-bottom/hy-safe-bottom.vue +5 -9
  170. package/components/hy-safe-bottom/index.scss +5 -0
  171. package/components/hy-scroll-list/hy-scroll-list.vue +13 -43
  172. package/components/hy-scroll-list/index.scss +34 -0
  173. package/components/hy-scroll-list/props.ts +2 -2
  174. package/components/hy-scroll-list/typing.d.ts +1 -1
  175. package/components/hy-search/hy-search.vue +12 -94
  176. package/components/hy-search/index.scss +83 -0
  177. package/components/hy-search/props.ts +2 -2
  178. package/components/hy-search/typing.d.ts +1 -2
  179. package/components/hy-slider/hy-slider.vue +42 -119
  180. package/components/hy-slider/index.scss +77 -0
  181. package/components/hy-slider/props.ts +2 -2
  182. package/components/hy-status-bar/hy-status-bar.vue +41 -0
  183. package/components/hy-status-bar/index.scss +6 -0
  184. package/components/hy-status-bar/props.ts +8 -0
  185. package/components/hy-status-bar/typing.d.ts +12 -0
  186. package/components/hy-steps/hy-steps.vue +36 -163
  187. package/components/hy-steps/index.scss +131 -0
  188. package/components/hy-steps/props.ts +2 -2
  189. package/components/hy-steps/typing.d.ts +2 -2
  190. package/components/hy-subsection/hy-subsection.vue +62 -125
  191. package/components/hy-subsection/index.scss +82 -0
  192. package/components/hy-subsection/props.ts +7 -3
  193. package/components/hy-subsection/typing.d.ts +20 -8
  194. package/components/hy-swipe-action/hy-swipe-action.vue +294 -0
  195. package/components/hy-swipe-action/index.scss +9 -0
  196. package/components/hy-swipe-action/index.wxs +235 -0
  197. package/components/hy-swipe-action/props.ts +16 -0
  198. package/components/hy-swipe-action/typing.d.ts +55 -0
  199. package/components/hy-swipe-action/wxs.js +15 -0
  200. package/components/hy-swiper/hy-swiper-indicator.vue +5 -35
  201. package/components/hy-swiper/hy-swiper.vue +45 -65
  202. package/components/hy-swiper/index.scss +82 -0
  203. package/components/hy-swiper/props.ts +3 -3
  204. package/components/hy-swiper/typing.d.ts +7 -4
  205. package/components/hy-switch/hy-switch.vue +65 -68
  206. package/components/hy-switch/index.scss +46 -0
  207. package/components/hy-switch/props.ts +6 -3
  208. package/components/hy-switch/typing.d.ts +14 -1
  209. package/components/hy-tabs/hy-tabs.vue +22 -81
  210. package/components/hy-tabs/index.scss +63 -0
  211. package/components/hy-tabs/props.ts +5 -5
  212. package/components/hy-tabs/typing.d.ts +1 -1
  213. package/components/hy-tag/hy-tag.vue +15 -230
  214. package/components/hy-tag/index.scss +204 -0
  215. package/components/hy-tag/props.ts +2 -2
  216. package/components/hy-tag/typing.d.ts +2 -2
  217. package/components/hy-text/hy-text.vue +238 -0
  218. package/components/hy-text/index.scss +70 -0
  219. package/components/hy-text/index.ts +0 -0
  220. package/components/hy-text/props.ts +30 -0
  221. package/components/hy-text/typing.d.ts +98 -0
  222. package/components/hy-textarea/hy-textarea.vue +13 -51
  223. package/components/hy-textarea/index.scss +40 -0
  224. package/components/hy-textarea/props.ts +2 -2
  225. package/components/hy-textarea/typing.d.ts +1 -1
  226. package/components/hy-tooltip/hy-tooltip.vue +42 -95
  227. package/components/hy-tooltip/index.scss +64 -0
  228. package/components/hy-tooltip/props.ts +2 -2
  229. package/components/hy-tooltip/typing.d.ts +1 -1
  230. package/components/hy-transition/hy-transition.vue +17 -8
  231. package/components/hy-transition/props.ts +2 -2
  232. package/components/hy-transition/typing.d.ts +2 -14
  233. package/components/hy-upload/hy-upload.vue +37 -182
  234. package/components/hy-upload/index.scss +147 -0
  235. package/components/hy-upload/props.ts +2 -2
  236. package/components/hy-upload/typing.d.ts +11 -11
  237. package/components/hy-warn/hy-warn.vue +15 -123
  238. package/components/hy-warn/index.scss +109 -0
  239. package/components/hy-warn/props.ts +3 -3
  240. package/components/hy-warn/typing.d.ts +4 -3
  241. package/components/hy-waterfall/index.scss +82 -0
  242. package/components/index.ts +25 -1
  243. package/components/message/index.ts +54 -54
  244. package/config/color.ts +2 -1
  245. package/global/index.ts +6 -6
  246. package/global/register-properties.ts +2 -2
  247. package/index.scss +2 -0
  248. package/libs/css/common.scss +16 -0
  249. package/package.json +4 -4
  250. package/{libs/css → public/font}/iconfont.css +5 -5
  251. package/{libs/css → public/font}/iconfont.ttf +0 -0
  252. package/public/font/iconfont.woff +0 -0
  253. package/public/font/iconfont.woff2 +0 -0
  254. package/theme.scss +9 -7
  255. package/typing/index.ts +0 -1
  256. package/typing/modules/common.d.ts +66 -1
  257. package/typing/modules/form.ts +3 -3
  258. package/utils/calendar.js +1021 -0
  259. package/utils/colorGradient.ts +112 -0
  260. package/utils/index.ts +2 -0
  261. package/utils/inside.ts +80 -34
  262. package/utils/inspect.ts +66 -0
  263. package/utils/utils.ts +27 -19
  264. package/typing/modules/img.ts +0 -15
@@ -14,7 +14,7 @@
14
14
  class="hy-qrcode__loading"
15
15
  :style="{ width: addUnit(size), height: addUnit(size) }"
16
16
  >
17
- <HyIcon :name="IconConfig.LOADING" is-rotate></HyIcon>
17
+ <HyLoading></HyLoading>
18
18
  </view>
19
19
  </view>
20
20
  </view>
@@ -23,11 +23,14 @@
23
23
  <script setup lang="ts">
24
24
  import { getCurrentInstance, toRefs, ref, onMounted } from "vue";
25
25
  import defaultProps from "./props";
26
- import IProps from "./typing";
26
+ import type IProps from "./typing";
27
27
  import QRCode from "./qrcode.js";
28
- import { addUnit } from "../../utils";
28
+ import { addUnit, error } from "../../utils";
29
29
  import { IconConfig } from "../../config";
30
+
31
+ // 组件
30
32
  import HyIcon from "../hy-icon/hy-icon.vue";
33
+ import HyLoading from "../hy-loading/hy-loading.vue";
31
34
 
32
35
  const props = withDefaults(defineProps<IProps>(), defaultProps);
33
36
  const { text, allowPreview } = toRefs(props);
@@ -39,12 +42,13 @@ const qrcode = ref("");
39
42
  const result = ref("");
40
43
 
41
44
  onMounted(() => {
45
+ console.log(111);
42
46
  initQrCode();
43
47
  });
44
48
 
45
49
  const initQrCode = () => {
46
50
  if (text.value) {
47
- loading.value;
51
+ loading.value = true;
48
52
  qrcode.value = new QRCode({
49
53
  context: instance, // 上下文环境
50
54
  canvasId: props.cid, // canvas-id
@@ -62,14 +66,10 @@ const initQrCode = () => {
62
66
  cbResult: function (res: any) {
63
67
  // 生成二维码的回调
64
68
  _result(res);
65
- }
69
+ },
66
70
  });
67
71
  } else {
68
- uni.showToast({
69
- title: "二维码内容不能为空",
70
- icon: "none",
71
- duration: 2000
72
- });
72
+ error("二维码内容不能为空");
73
73
  }
74
74
  };
75
75
 
@@ -87,9 +87,9 @@ const _saveCode = () => {
87
87
  uni.showToast({
88
88
  title: "二维码保存成功",
89
89
  icon: "success",
90
- duration: 2000
90
+ duration: 2000,
91
91
  });
92
- }
92
+ },
93
93
  });
94
94
  }
95
95
  };
@@ -114,8 +114,8 @@ const preview = (e) => {
114
114
  },
115
115
  fail: function (err) {
116
116
  console.error(err.errMsg);
117
- }
118
- }
117
+ },
118
+ },
119
119
  });
120
120
  }
121
121
  emit("preview", result.value, e);
@@ -127,27 +127,5 @@ const onLongPress = () => {
127
127
  </script>
128
128
 
129
129
  <style lang="scss" scoped>
130
- .hy-qrcode {
131
- &__loading {
132
- display: flex;
133
- justify-content: center;
134
- align-items: center;
135
- background-color: #f7f7f7;
136
- position: absolute;
137
- top: 0;
138
- bottom: 0;
139
- left: 0;
140
- right: 0;
141
- }
142
- &__content {
143
- position: relative;
144
-
145
- &__canvas {
146
- position: fixed;
147
- top: -99999rpx;
148
- left: -99999rpx;
149
- z-index: -99999;
150
- }
151
- }
152
- }
130
+ @import "./index.scss";
153
131
  </style>
@@ -0,0 +1,23 @@
1
+ .hy-qrcode {
2
+ &__loading {
3
+ display: flex;
4
+ justify-content: center;
5
+ align-items: center;
6
+ background-color: #f7f7f7;
7
+ position: absolute;
8
+ top: 0;
9
+ bottom: 0;
10
+ left: 0;
11
+ right: 0;
12
+ }
13
+ &__content {
14
+ position: relative;
15
+
16
+ &__canvas {
17
+ position: fixed;
18
+ top: -99999rpx;
19
+ left: -99999rpx;
20
+ z-index: -99999;
21
+ }
22
+ }
23
+ }
@@ -1,4 +1,4 @@
1
- import IProps from "./typing";
1
+ import type IProps from "./typing";
2
2
 
3
3
  const defaultProps: IProps = {
4
4
  cid: "hy-qrcode-canvas" + Math.random().toString(),
@@ -14,7 +14,7 @@ const defaultProps: IProps = {
14
14
  iconSize: 40,
15
15
  showLoading: true,
16
16
  loadingText: "二维码生成中",
17
- allowPreview: false
17
+ allowPreview: false,
18
18
  };
19
19
 
20
20
  export default defaultProps;
@@ -1,8 +1,8 @@
1
- import { CSSProperties } from "vue";
1
+ import type { CSSProperties } from "vue";
2
2
 
3
3
  export default interface IProps {
4
4
  /**
5
- * @description 实例ID字符串(必须)
5
+ * @description 实例ID字符串(如果有多个二维码组件必须设置不一样的cid)
6
6
  * */
7
7
  cid?: string;
8
8
  /**
@@ -7,7 +7,7 @@
7
7
  :style="radioStyle"
8
8
  :class="[
9
9
  `hy-radio-label--${iconPlacement}`,
10
- borderBottom && placement === 'column' && 'hy-border-bottom'
10
+ borderBottom && placement === 'column' && 'hy-border__bottom',
11
11
  ]"
12
12
  >
13
13
  <view
@@ -19,12 +19,12 @@
19
19
  <slot
20
20
  name="icon"
21
21
  :iconColor="iconColor"
22
- :iconSize="addUnit(iconSize)"
22
+ :iconSize="addUnit(sizeType[size] ?? iconSize)"
23
23
  >
24
24
  <HyIcon
25
25
  class="hy-radio__icon-wrap__icon"
26
26
  :name="IconConfig.CHECK_MASK"
27
- :size="addUnit(iconSize)"
27
+ :size="addUnit(sizeType[size] ?? iconSize)"
28
28
  :color="iconColorCom(item.checked)"
29
29
  />
30
30
  </slot>
@@ -38,7 +38,7 @@
38
38
  class="hy-radio__text"
39
39
  :style="{
40
40
  color: labelColor,
41
- fontSize: labelSize
41
+ fontSize: addUnit(sizeType[size] ?? labelSize),
42
42
  }"
43
43
  >{{ item[fieldNames.label] }}</text
44
44
  >
@@ -50,10 +50,17 @@
50
50
  </template>
51
51
 
52
52
  <script setup lang="ts">
53
- import IProps from "./typing";
54
- import { CheckboxColumnsVo } from "../hy-check-button/typing";
53
+ import type IProps from "./typing";
54
+ import type { CheckboxColumnsVo } from "../hy-check-button/typing";
55
55
  import defaultProps from "./props";
56
- import { computed, CSSProperties, ref, toRefs, watch } from "vue";
56
+ import {
57
+ computed,
58
+ type CSSProperties,
59
+ reactive,
60
+ ref,
61
+ toRefs,
62
+ watch,
63
+ } from "vue";
57
64
  import { addUnit, bem, error } from "../../utils";
58
65
  import { IconConfig } from "../../config";
59
66
 
@@ -73,21 +80,27 @@ const {
73
80
  customStyle,
74
81
  borderBottom,
75
82
  placement,
76
- iconColor
83
+ iconColor,
77
84
  } = toRefs(props);
78
85
  const emit = defineEmits(["change", "update:modelValue"]);
79
86
 
80
87
  const columns_1 = ref();
88
+ const sizeType: AnyObject = reactive({
89
+ small: 14,
90
+ medium: 18,
91
+ large: 22,
92
+ });
81
93
 
82
94
  watch(
83
95
  () => modelValue.value,
84
96
  (newValue) => {
85
97
  columns_1.value = columns.value.map((item: any) => {
86
- item[fieldNames.value.checked] = newValue == item[fieldNames.value.value];
98
+ item[fieldNames.value.checked] =
99
+ newValue === item[fieldNames.value.value];
87
100
  return item;
88
101
  });
89
102
  },
90
- { immediate: true }
103
+ { immediate: true },
91
104
  );
92
105
 
93
106
  const isDisabled = (disabledVal?: boolean): boolean =>
@@ -116,7 +129,7 @@ const radioStyle = computed(() => {
116
129
  const style: CSSProperties = {};
117
130
  if (borderBottom.value && placement.value === "row") {
118
131
  error(
119
- "检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效"
132
+ "检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效",
120
133
  );
121
134
  }
122
135
  // 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
@@ -162,8 +175,8 @@ const iconWrapStyle = computed(() => {
162
175
  temp[fieldNames.value.checked] && !isDisabled(temp?.disabled)
163
176
  ? activeColor.value
164
177
  : inactiveColor.value;
165
- style.width = addUnit(size.value);
166
- style.height = addUnit(size.value);
178
+ style.width = addUnit(sizeType[size.value] ?? size.value);
179
+ style.height = addUnit(sizeType[size.value] ?? size.value);
167
180
  return style;
168
181
  };
169
182
  });
@@ -216,104 +229,5 @@ const setRadioCheckedStatus = (temp: CheckboxColumnsVo) => {
216
229
  </script>
217
230
 
218
231
  <style lang="scss" scoped>
219
- @import "../../libs/css/mixin.scss";
220
- @import "../../theme.scss";
221
-
222
- .hy-radio {
223
- /* #ifndef APP-NVUE */
224
- @include flex(row);
225
- /* #endif */
226
- overflow: hidden;
227
- flex-direction: row;
228
- align-items: center;
229
- margin-bottom: 5px;
230
- margin-top: 5px;
231
-
232
- &-group {
233
- flex: 1;
234
-
235
- &--row {
236
- /* #ifndef APP-NVUE */
237
- display: flex;
238
- /* #endif */
239
- flex-flow: row wrap;
240
- }
241
-
242
- &--column {
243
- @include flex(column);
244
- margin: $hy-border-margin-padding-lg 0;
245
- }
246
- }
247
-
248
- &-label--left {
249
- flex-direction: row;
250
- }
251
-
252
- &-label--right {
253
- flex-direction: row-reverse;
254
- justify-content: space-between;
255
- }
256
-
257
- &__icon-wrap {
258
- /* #ifndef APP-NVUE */
259
- box-sizing: border-box;
260
- // nvue下,border-color过渡有问题
261
- transition-property: border-color, background-color, color;
262
- transition-duration: 0.2s;
263
- /* #endif */
264
- @include flex;
265
- align-items: center;
266
- justify-content: center;
267
- color: transparent;
268
- text-align: center;
269
- margin-right: $hy-border-margin-padding-sm;
270
- border: $hy-border-line;
271
-
272
- /* #ifdef MP-TOUTIAO */
273
- // 头条小程序兼容性问题,需要设置行高为0,否则图标偏下
274
- &__icon {
275
- line-height: 0;
276
- }
277
-
278
- /* #endif */
279
-
280
- &--circle {
281
- border-radius: 50%;
282
- }
283
-
284
- &--square {
285
- border-radius: 3px;
286
- }
287
-
288
- &--checked {
289
- color: $hy-text-color-inverse;
290
- background-color: $hy-primary;
291
- border-color: $hy-primary;
292
- }
293
-
294
- &--disabled {
295
- background-color: $hy-color-disable-bg !important;
296
- }
297
-
298
- &--disabled--checked {
299
- color: $hy-color-disable-icon !important;
300
- }
301
- }
302
-
303
- &__label-wrap {
304
- /* #ifndef APP-NVUE */
305
- word-wrap: break-word;
306
- /* #endif */
307
- color: $hy-text-color;
308
- font-size: $hy-font-size-base;
309
- margin-right: $hy-border-margin-padding-sm;
310
-
311
- &--disabled {
312
- color: $hy-text-color-disable;
313
- }
314
- }
315
- }
316
- .hy-border-bottom {
317
- border-bottom: $hy-border-line;
318
- }
232
+ @import "./index.scss";
319
233
  </style>
@@ -0,0 +1,93 @@
1
+ @use "../../theme.scss" as *;
2
+ @use "../../libs/css/mixin.scss" as *;
3
+
4
+ .hy-radio {
5
+ @include flex(row);
6
+ overflow: hidden;
7
+ flex-direction: row;
8
+ align-items: center;
9
+ margin-bottom: 5px;
10
+ margin-top: 5px;
11
+
12
+ &-group {
13
+ flex: 1;
14
+
15
+ &--row {
16
+ @include flex(row);
17
+ flex-flow: row wrap;
18
+ }
19
+
20
+ &--column {
21
+ @include flex(column);
22
+ margin: $hy-border-margin-padding-lg 0;
23
+ }
24
+ }
25
+
26
+ &-label--left {
27
+ flex-direction: row;
28
+ }
29
+
30
+ &-label--right {
31
+ flex-direction: row-reverse;
32
+ justify-content: space-between;
33
+ }
34
+
35
+ &__icon-wrap {
36
+ /* #ifndef APP-NVUE */
37
+ box-sizing: border-box;
38
+ // nvue下,border-color过渡有问题
39
+ transition-property: border-color, background-color, color;
40
+ transition-duration: 0.2s;
41
+ /* #endif */
42
+ @include flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ color: transparent;
46
+ text-align: center;
47
+ margin-right: $hy-border-margin-padding-sm;
48
+ border: $hy-border-line;
49
+
50
+ /* #ifdef MP-TOUTIAO */
51
+ // 头条小程序兼容性问题,需要设置行高为0,否则图标偏下
52
+ &__icon {
53
+ line-height: 0;
54
+ }
55
+
56
+ /* #endif */
57
+
58
+ &--circle {
59
+ border-radius: 50%;
60
+ }
61
+
62
+ &--square {
63
+ border-radius: 3px;
64
+ }
65
+
66
+ &--checked {
67
+ color: $hy-text-color-inverse;
68
+ background-color: $hy-primary;
69
+ border-color: $hy-primary;
70
+ }
71
+
72
+ &--disabled {
73
+ background-color: $hy-color-disable-bg !important;
74
+ }
75
+
76
+ &--disabled--checked {
77
+ color: $hy-color-disable-icon !important;
78
+ }
79
+ }
80
+
81
+ &__label-wrap {
82
+ /* #ifndef APP-NVUE */
83
+ word-wrap: break-word;
84
+ /* #endif */
85
+ color: $hy-text-color;
86
+ font-size: $hy-font-size-base;
87
+ margin-right: $hy-border-margin-padding-sm;
88
+
89
+ &--disabled {
90
+ color: $hy-text-color-disable;
91
+ }
92
+ }
93
+ }
@@ -1,4 +1,4 @@
1
- import IProps from "./typing";
1
+ import type IProps from "./typing";
2
2
  import { ColorConfig } from "../../config";
3
3
 
4
4
  const defaultProps: IProps = {
@@ -7,10 +7,10 @@ const defaultProps: IProps = {
7
7
  fieldNames: {
8
8
  label: "label",
9
9
  value: "value",
10
- checked: "checked"
10
+ checked: "checked",
11
11
  },
12
12
  shape: "circle",
13
- size: 20,
13
+ size: "medium",
14
14
  disabled: false,
15
15
  activeColor: ColorConfig.primary,
16
16
  inactiveColor: "#c8c9cc",
@@ -22,7 +22,7 @@ const defaultProps: IProps = {
22
22
  labelSize: "",
23
23
  labelColor: "",
24
24
  labelDisabled: "",
25
- placement: "row"
25
+ placement: "row",
26
26
  };
27
27
 
28
28
  export default defaultProps;
@@ -25,7 +25,7 @@ export default interface IProps {
25
25
  /**
26
26
  * @description 整体的大小
27
27
  * */
28
- size?: string | number;
28
+ size?: HyApp.SizeType | string | number;
29
29
  /**
30
30
  * @description 是否默认选中
31
31
  * */
@@ -81,5 +81,5 @@ export default interface IProps {
81
81
  /**
82
82
  * @description 布局方式,row-横向,column-纵向
83
83
  * */
84
- placement?: HyApp.PermutationType;
84
+ placement?: HyApp.DirectionType;
85
85
  }
@@ -22,11 +22,11 @@
22
22
  disabled
23
23
  ? '#c8c9cc'
24
24
  : Math.floor(activeIndex) > index
25
- ? activeColor
26
- : inactiveColor
25
+ ? activeColor
26
+ : inactiveColor
27
27
  "
28
28
  :custom-style="{
29
- padding: `0 ${addUnit(gutter / 2)}`
29
+ padding: `0 ${addUnit(gutter / 2)}`,
30
30
  }"
31
31
  :size="size"
32
32
  ></HyIcon>
@@ -37,8 +37,8 @@
37
37
  class="hy-rate__content__item__icon-wrap hy-rate__content__item__icon-wrap--half"
38
38
  :style="[
39
39
  {
40
- width: addUnit(rateWidth / 2)
41
- }
40
+ width: addUnit(rateWidth / 2),
41
+ },
42
42
  ]"
43
43
  ref="hy-rate__content__item__icon-wrap"
44
44
  >
@@ -48,11 +48,11 @@
48
48
  disabled
49
49
  ? '#c8c9cc'
50
50
  : Math.ceil(activeIndex) > index
51
- ? activeColor
52
- : inactiveColor
51
+ ? activeColor
52
+ : inactiveColor
53
53
  "
54
54
  :custom-style="{
55
- padding: `0 ${addUnit(gutter / 2)}`
55
+ padding: `0 ${addUnit(gutter / 2)}`,
56
56
  }"
57
57
  :size="size"
58
58
  ></HyIcon>
@@ -64,8 +64,8 @@
64
64
 
65
65
  <script setup lang="ts">
66
66
  import { addUnit, getRect, guid, range, sleep } from "../../utils";
67
- import { ref, watch, toRefs, onMounted, nextTick } from "vue";
68
- import IProps from "./typing";
67
+ import { ref, watch, toRefs, onMounted, getCurrentInstance } from "vue";
68
+ import type IProps from "./typing";
69
69
  import defaultProps from "./props";
70
70
 
71
71
  // 组件
@@ -79,7 +79,7 @@ const {
79
79
  count,
80
80
  disabled,
81
81
  readonly,
82
- allowHalf
82
+ allowHalf,
83
83
  } = toRefs(props);
84
84
  const emit = defineEmits(["update:modelValue", "change"]);
85
85
 
@@ -96,40 +96,52 @@ watch(
96
96
  () => modelValue.value,
97
97
  (newValue) => {
98
98
  activeIndex.value = newValue;
99
- }
99
+ },
100
100
  );
101
101
  watch(
102
102
  () => activeIndex.value,
103
103
  (newVal) => {
104
104
  emitEvent();
105
- }
105
+ },
106
106
  );
107
+ const instance = getCurrentInstance();
107
108
 
108
109
  onMounted(() => {
109
110
  init();
110
111
  });
111
112
 
112
113
  const init = () => {
113
- sleep(200).then(() => {
114
- getRateItemRect();
115
- getRateIconWrapRect();
114
+ sleep(300).then(async () => {
115
+ await getRateItemRect();
116
+ await getRateIconWrapRect();
116
117
  });
117
118
  };
118
119
 
119
- // 获取评分组件盒子的布局信息
120
+ /**
121
+ * @description 获取评分组件盒子的布局信息
122
+ * */
120
123
  const getRateItemRect = async () => {
121
124
  await sleep();
122
125
  // #ifndef APP-NVUE
123
- const res: UniApp.NodeInfo = (await getRect(`#${elId}`)) as UniApp.NodeInfo;
126
+ const res: UniApp.NodeInfo = (await getRect(
127
+ `#${elId}`,
128
+ false,
129
+ instance,
130
+ )) as UniApp.NodeInfo;
124
131
  rateBoxLeft.value = res.left || 0;
125
132
  // #endif
126
133
  };
127
- // 获取单个星星的尺寸
134
+
135
+ /**
136
+ * @description 获取单个星星的尺寸
137
+ * */
128
138
  const getRateIconWrapRect = async () => {
129
139
  // uView封装的获取节点的方法,详见文档
130
140
  // #ifndef APP-NVUE
131
141
  const res: UniApp.NodeInfo = (await getRect(
132
- `.${elClass}`
142
+ `.${elClass}`,
143
+ false,
144
+ instance,
133
145
  )) as UniApp.NodeInfo;
134
146
  rateWidth.value = res.width || 0;
135
147
  // #endif
@@ -225,37 +237,5 @@ const getActiveIndex = (x: number, isClick = false) => {
225
237
  </script>
226
238
 
227
239
  <style lang="scss" scoped>
228
- @import "../../libs/css/mixin.scss";
229
-
230
- .hy-rate {
231
- @include flex;
232
- align-items: center;
233
- margin: 0;
234
- padding: 0;
235
- /* #ifndef APP-NVUE */
236
- touch-action: none;
237
- /* #endif */
238
-
239
- &__content {
240
- @include flex;
241
-
242
- &__item {
243
- position: relative;
244
-
245
- &__icon-wrap {
246
- &--half {
247
- position: absolute;
248
- overflow: hidden;
249
- top: 0;
250
- left: 0;
251
- }
252
- }
253
- }
254
- }
255
- }
256
- .hy-icon {
257
- /* #ifndef APP-NVUE */
258
- box-sizing: border-box;
259
- /* #endif */
260
- }
240
+ @import "./index.scss";
261
241
  </style>
@@ -0,0 +1,33 @@
1
+ @use "../../libs/css/mixin.scss" as *;
2
+
3
+ .hy-rate {
4
+ @include flex;
5
+ align-items: center;
6
+ margin: 0;
7
+ padding: 0;
8
+ /* #ifndef APP-NVUE */
9
+ touch-action: none;
10
+ /* #endif */
11
+
12
+ &__content {
13
+ @include flex;
14
+
15
+ &__item {
16
+ position: relative;
17
+
18
+ &__icon-wrap {
19
+ &--half {
20
+ position: absolute;
21
+ overflow: hidden;
22
+ top: 0;
23
+ left: 0;
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+ .hy-icon {
30
+ /* #ifndef APP-NVUE */
31
+ box-sizing: border-box;
32
+ /* #endif */
33
+ }