hy-app 0.1.2 → 0.1.4

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 (247) 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 +3 -29
  5. package/components/hy-address-picker/index.scss +27 -0
  6. package/components/hy-avatar/hy-avatar.vue +1 -45
  7. package/components/hy-avatar/index.scss +45 -0
  8. package/components/hy-avatar/typing.d.ts +1 -1
  9. package/components/hy-back-top/hy-back-top.vue +7 -22
  10. package/components/hy-back-top/index.scss +16 -0
  11. package/components/hy-back-top/props.ts +4 -4
  12. package/components/hy-back-top/typing.d.ts +2 -3
  13. package/components/hy-badge/hy-badge.vue +1 -72
  14. package/components/hy-badge/index.scss +72 -0
  15. package/components/hy-button/hy-button.vue +17 -128
  16. package/components/hy-button/index.scss +116 -0
  17. package/components/hy-button/typing.d.ts +1 -1
  18. package/components/hy-calendar/header.vue +76 -0
  19. package/components/hy-calendar/hy-calendar.vue +366 -0
  20. package/components/hy-calendar/index.scss +171 -0
  21. package/components/hy-calendar/month.vue +524 -0
  22. package/components/hy-calendar/props.ts +37 -0
  23. package/components/hy-calendar/typing.d.ts +126 -0
  24. package/components/hy-card/hy-card.vue +21 -84
  25. package/components/hy-card/index.scss +57 -0
  26. package/components/hy-card/props.ts +2 -2
  27. package/components/hy-card/typing.d.ts +1 -1
  28. package/components/hy-cell/hy-cell.vue +1 -137
  29. package/components/hy-cell/index.scss +137 -0
  30. package/components/hy-check-button/hy-check-button.vue +1 -0
  31. package/components/hy-check-button/index.scss +5 -0
  32. package/components/hy-checkbox/hy-checkbox.vue +2 -95
  33. package/components/hy-checkbox/index.scss +94 -0
  34. package/components/hy-checkbox/typing.d.ts +1 -2
  35. package/components/hy-count-down/hy-count-down.vue +150 -0
  36. package/components/hy-count-down/index.scss +6 -0
  37. package/components/hy-count-down/index.ts +52 -0
  38. package/components/hy-count-down/props.ts +10 -0
  39. package/components/hy-count-down/typing.d.ts +20 -0
  40. package/components/hy-count-to/hy-count-to.vue +213 -0
  41. package/components/hy-count-to/index.scss +6 -0
  42. package/components/hy-count-to/props.ts +17 -0
  43. package/components/hy-count-to/typing.d.ts +48 -0
  44. package/components/hy-datetime-picker/hy-datetime-picker.vue +2 -28
  45. package/components/hy-datetime-picker/index.scss +28 -0
  46. package/components/hy-divider/hy-divider.vue +24 -49
  47. package/components/hy-divider/index.scss +26 -0
  48. package/components/hy-divider/props.ts +2 -2
  49. package/components/hy-divider/typing.d.ts +1 -1
  50. package/components/hy-dropdown/hy-dropdown.vue +43 -0
  51. package/components/hy-dropdown/index.scss +17 -0
  52. package/components/hy-dropdown/props.ts +17 -0
  53. package/components/hy-dropdown/typing.d.ts +48 -0
  54. package/components/hy-dropdown-item/hy-dropdown-item.vue +194 -0
  55. package/components/hy-dropdown-item/index.scss +96 -0
  56. package/components/hy-dropdown-item/props.ts +10 -0
  57. package/components/hy-dropdown-item/typing.d.ts +31 -0
  58. package/components/hy-empty/hy-empty.vue +8 -26
  59. package/components/hy-empty/index.scss +19 -0
  60. package/components/hy-empty/props.ts +2 -2
  61. package/components/hy-empty/typing.d.ts +1 -1
  62. package/components/hy-float-button/hy-float-button.vue +217 -0
  63. package/components/hy-float-button/index.scss +67 -0
  64. package/components/hy-float-button/props.ts +25 -0
  65. package/components/hy-float-button/typing.d.ts +93 -0
  66. package/components/hy-folding-panel/hy-folding-panel.vue +9 -12
  67. package/components/hy-folding-panel/index.scss +6 -0
  68. package/components/hy-folding-panel/props.ts +2 -2
  69. package/components/hy-folding-panel/typing.d.ts +2 -2
  70. package/components/hy-form/hy-form.vue +17 -34
  71. package/components/hy-form/index.scss +30 -0
  72. package/components/hy-form/props.ts +2 -0
  73. package/components/hy-form/typing.d.ts +9 -1
  74. package/components/hy-grid/hy-grid.vue +1 -43
  75. package/components/hy-grid/index.scss +40 -0
  76. package/components/hy-icon/hy-icon.vue +1 -93
  77. package/components/hy-icon/index.scss +84 -0
  78. package/components/hy-image/hy-image.vue +216 -0
  79. package/components/hy-image/index.scss +26 -0
  80. package/components/hy-image/props.ts +24 -0
  81. package/components/hy-image/typing.d.ts +76 -0
  82. package/components/hy-input/hy-input.vue +2 -72
  83. package/components/hy-input/index.scss +65 -0
  84. package/components/hy-line/hy-line.vue +4 -8
  85. package/components/hy-line/index.scss +5 -0
  86. package/components/hy-line/props.ts +3 -3
  87. package/components/hy-line/typing.d.ts +2 -2
  88. package/components/hy-line-progress/hy-line-progress.vue +15 -44
  89. package/components/hy-line-progress/index.scss +38 -0
  90. package/components/hy-line-progress/props.ts +2 -2
  91. package/components/hy-line-progress/typing.d.ts +1 -1
  92. package/components/hy-list/hy-list.vue +11 -41
  93. package/components/hy-list/index.scss +32 -0
  94. package/components/hy-list/props.ts +2 -2
  95. package/components/hy-loading/hy-loading.vue +95 -0
  96. package/components/hy-loading/index.scss +103 -0
  97. package/components/hy-loading/props.ts +17 -0
  98. package/components/hy-loading/typing.d.ts +53 -0
  99. package/components/hy-login/TheUserLogin.vue +20 -88
  100. package/components/hy-login/hy-login.vue +9 -9
  101. package/components/hy-login/props.ts +4 -4
  102. package/components/hy-modal/hy-modal.vue +11 -89
  103. package/components/hy-modal/index.scss +77 -0
  104. package/components/hy-modal/props.ts +2 -2
  105. package/components/hy-modal/typing.d.ts +1 -1
  106. package/components/hy-navbar/hy-navbar.vue +20 -92
  107. package/components/hy-navbar/index.scss +67 -0
  108. package/components/hy-navbar/props.ts +2 -2
  109. package/components/hy-navbar/typing.d.ts +1 -1
  110. package/components/hy-notice-bar/hy-column-notice.vue +11 -39
  111. package/components/hy-notice-bar/hy-notice-bar.vue +10 -12
  112. package/components/hy-notice-bar/hy-row-notice.vue +16 -58
  113. package/components/hy-notice-bar/index.scss +93 -0
  114. package/components/hy-notice-bar/props.ts +4 -2
  115. package/components/hy-notice-bar/typing.d.ts +13 -3
  116. package/components/hy-number-step/hy-number-step.vue +1 -70
  117. package/components/hy-number-step/index.scss +71 -0
  118. package/components/hy-overlay/hy-overlay.vue +2 -14
  119. package/components/hy-overlay/index.scss +9 -0
  120. package/components/hy-parse/hy-parse.vue +499 -0
  121. package/components/hy-parse/index.scss +9 -0
  122. package/components/hy-parse/node/node.vue +584 -0
  123. package/components/hy-parse/parser.js +1337 -0
  124. package/components/hy-parse/props.ts +19 -0
  125. package/components/hy-parse/typing.d.ts +68 -0
  126. package/components/hy-picker/hy-picker.vue +1 -68
  127. package/components/hy-picker/index.scss +68 -0
  128. package/components/hy-popup/hy-popup.vue +1 -74
  129. package/components/hy-popup/index.scss +60 -0
  130. package/components/hy-price/hy-price.vue +7 -19
  131. package/components/hy-price/index.scss +11 -0
  132. package/components/hy-price/props.ts +4 -3
  133. package/components/hy-price/typing.d.ts +8 -4
  134. package/components/hy-qrcode/hy-qrcode.vue +15 -37
  135. package/components/hy-qrcode/index.scss +23 -0
  136. package/components/hy-qrcode/props.ts +2 -2
  137. package/components/hy-qrcode/typing.d.ts +2 -2
  138. package/components/hy-radio/hy-radio.vue +2 -101
  139. package/components/hy-radio/index.scss +93 -0
  140. package/components/hy-radio/typing.d.ts +1 -2
  141. package/components/hy-rate/hy-rate.vue +1 -33
  142. package/components/hy-rate/index.scss +33 -0
  143. package/components/hy-read-more/hy-read-more.vue +7 -30
  144. package/components/hy-read-more/index.scss +25 -0
  145. package/components/hy-read-more/props.ts +3 -3
  146. package/components/hy-read-more/typing.d.ts +1 -1
  147. package/components/hy-safe-bottom/hy-safe-bottom.vue +5 -9
  148. package/components/hy-safe-bottom/index.scss +5 -0
  149. package/components/hy-scroll-list/hy-scroll-list.vue +13 -43
  150. package/components/hy-scroll-list/index.scss +34 -0
  151. package/components/hy-scroll-list/props.ts +2 -2
  152. package/components/hy-scroll-list/typing.d.ts +1 -1
  153. package/components/hy-search/hy-search.vue +1 -83
  154. package/components/hy-search/index.scss +83 -0
  155. package/components/hy-slider/hy-slider.vue +18 -95
  156. package/components/hy-slider/index.scss +77 -0
  157. package/components/hy-status-bar/hy-status-bar.vue +41 -0
  158. package/components/hy-status-bar/index.scss +6 -0
  159. package/components/hy-status-bar/props.ts +8 -0
  160. package/components/hy-status-bar/typing.d.ts +12 -0
  161. package/components/hy-steps/hy-steps.vue +36 -163
  162. package/components/hy-steps/index.scss +131 -0
  163. package/components/hy-steps/props.ts +2 -2
  164. package/components/hy-steps/typing.d.ts +2 -2
  165. package/components/hy-submitBar/Index.vue +17 -0
  166. package/components/hy-submitBar/hy-submitBar.vue +216 -0
  167. package/components/hy-submitBar/index.scss +9 -0
  168. package/components/hy-submitBar/props.ts +22 -0
  169. package/components/hy-submitBar/typing.d.ts +88 -0
  170. package/components/hy-subsection/hy-subsection.vue +40 -132
  171. package/components/hy-subsection/index.scss +82 -0
  172. package/components/hy-subsection/props.ts +1 -0
  173. package/components/hy-subsection/typing.d.ts +13 -4
  174. package/components/hy-swipe-action/hy-swipe-action.vue +294 -0
  175. package/components/hy-swipe-action/index.scss +9 -0
  176. package/components/hy-swipe-action/index.wxs +235 -0
  177. package/components/hy-swipe-action/props.ts +16 -0
  178. package/components/hy-swipe-action/typing.d.ts +55 -0
  179. package/components/hy-swipe-action/wxs.js +15 -0
  180. package/components/hy-swiper/hy-swiper-indicator.vue +5 -35
  181. package/components/hy-swiper/hy-swiper.vue +1 -54
  182. package/components/hy-swiper/index.scss +82 -0
  183. package/components/hy-switch/hy-switch.vue +62 -72
  184. package/components/hy-switch/index.scss +46 -0
  185. package/components/hy-switch/props.ts +4 -1
  186. package/components/hy-switch/typing.d.ts +14 -1
  187. package/components/hy-tabs/hy-tabs.vue +22 -81
  188. package/components/hy-tabs/index.scss +63 -0
  189. package/components/hy-tabs/props.ts +5 -5
  190. package/components/hy-tabs/typing.d.ts +1 -1
  191. package/components/hy-tag/hy-tag.vue +25 -220
  192. package/components/hy-tag/index.scss +205 -0
  193. package/components/hy-text/hy-text.vue +238 -0
  194. package/components/hy-text/index.scss +70 -0
  195. package/components/hy-text/index.ts +0 -0
  196. package/components/hy-text/props.ts +30 -0
  197. package/components/hy-text/typing.d.ts +98 -0
  198. package/components/hy-textarea/hy-textarea.vue +1 -46
  199. package/components/hy-textarea/index.scss +40 -0
  200. package/components/hy-toast/hy-toast.vue +175 -0
  201. package/components/hy-toast/index.scss +77 -0
  202. package/components/hy-toast/props.ts +3 -0
  203. package/components/hy-toast/typing.d.ts +38 -0
  204. package/components/hy-tooltip/hy-tooltip.vue +42 -95
  205. package/components/hy-tooltip/index.scss +64 -0
  206. package/components/hy-tooltip/props.ts +2 -2
  207. package/components/hy-tooltip/typing.d.ts +1 -1
  208. package/components/hy-transition/hy-transition.vue +4 -2
  209. package/components/hy-transition/typing.d.ts +1 -13
  210. package/components/hy-upload/hy-upload.vue +37 -182
  211. package/components/hy-upload/index.scss +147 -0
  212. package/components/hy-upload/props.ts +2 -2
  213. package/components/hy-upload/typing.d.ts +11 -11
  214. package/components/hy-warn/hy-warn.vue +17 -144
  215. package/components/hy-warn/index.scss +109 -0
  216. package/components/hy-warn/props.ts +3 -3
  217. package/components/hy-warn/typing.d.ts +4 -3
  218. package/components/hy-waterfall/hy-waterfall.vue +168 -38
  219. package/components/hy-waterfall/index.scss +16 -0
  220. package/components/hy-waterfall/props.ts +4 -5
  221. package/components/hy-waterfall/typing.d.ts +5 -9
  222. package/components/index.ts +25 -1
  223. package/components/message/index.ts +54 -54
  224. package/composables/index.ts +1 -0
  225. package/composables/useShare.ts +27 -0
  226. package/config/color.ts +3 -2
  227. package/config/icon.ts +21 -1
  228. package/global/index.ts +6 -6
  229. package/global/register-properties.ts +2 -2
  230. package/index.scss +2 -1
  231. package/index.ts +9 -8
  232. package/libs/css/common.scss +14 -2
  233. package/package.json +3 -2
  234. package/{libs/css → public/font}/iconfont.css +4 -4
  235. package/theme.scss +6 -4
  236. package/typing/index.ts +1 -1
  237. package/typing/modules/common.d.ts +36 -1
  238. package/utils/calendar.js +1021 -0
  239. package/utils/colorGradient.ts +112 -0
  240. package/utils/index.ts +2 -0
  241. package/utils/inside.ts +80 -34
  242. package/utils/inspect.ts +115 -0
  243. package/utils/utils.ts +20 -19
  244. package/libs/css/download.zip +0 -0
  245. /package/{libs/css → public/font}/iconfont.ttf +0 -0
  246. /package/{libs/css → public/font}/iconfont.woff +0 -0
  247. /package/{libs/css → public/font}/iconfont.woff2 +0 -0
@@ -0,0 +1,22 @@
1
+ import type IProps from "./typing";
2
+
3
+ const defaultProps: IProps = {
4
+ menus: [],
5
+ fixed: true,
6
+ border: true,
7
+ leftLoading: false,
8
+ rightLoading: false,
9
+ iconColor: "",
10
+ iconLabelColor: "#909193FF",
11
+ textColor: "",
12
+ showLeftBtn: true,
13
+ showRightBtn: true,
14
+ leftBtnText: "加入购物车",
15
+ rightBtnText: "立即购买",
16
+ leftBtnColor: "#ed3f14",
17
+ rightBtnColor: "#ff7900",
18
+ shape: "circle",
19
+ warn: 300,
20
+ };
21
+
22
+ export default defaultProps;
@@ -0,0 +1,88 @@
1
+ import type { CSSProperties } from "vue";
2
+ import type BadgeProps from "../hy-badge/props";
3
+
4
+ interface IconMenus {
5
+ /**
6
+ * @description icon图标
7
+ * */
8
+ icon: string;
9
+ /**
10
+ * @description 文本
11
+ * */
12
+ text: string;
13
+ /**
14
+ * @description 徽标值
15
+ * */
16
+ badge?: BadgeProps["badge"];
17
+ }
18
+
19
+ export default interface IProps {
20
+ /**
21
+ * @description 左边菜单栏
22
+ * */
23
+ menus?: IconMenus[];
24
+ /**
25
+ * @description 绝对定位
26
+ * */
27
+ fixed?: boolean;
28
+ /**
29
+ * @description 是否显示边框
30
+ * */
31
+ border?: boolean;
32
+ /**
33
+ * @description 加载左边按钮loading
34
+ * */
35
+ leftLoading?: boolean;
36
+ /**
37
+ * @description 加载右边按钮loading
38
+ * */
39
+ rightLoading?: boolean;
40
+ /**
41
+ * @description 左边icon的颜色
42
+ * */
43
+ iconColor?: string;
44
+ /**
45
+ * @description 左边文字的颜色
46
+ * */
47
+ iconLabelColor?: string;
48
+ /**
49
+ * @description 右边按钮文字颜色
50
+ * */
51
+ textColor?: string;
52
+ /**
53
+ * @description 显示左边按钮
54
+ * */
55
+ showLeftBtn?: boolean;
56
+ /**
57
+ * @description 显示右边按钮
58
+ * */
59
+ showRightBtn?: boolean;
60
+ /**
61
+ * @description 左边按钮文字
62
+ * */
63
+ leftBtnText?: string;
64
+ /**
65
+ * @description 右边按钮文字
66
+ * */
67
+ rightBtnText?: string;
68
+ /**
69
+ * @description 左边按钮颜色,支持渐变色
70
+ * */
71
+ leftBtnColor?: string;
72
+ /**
73
+ * @description 有边按钮颜色,支持渐变色
74
+ * */
75
+ rightBtnColor?: string;
76
+ /**
77
+ * @description 按钮的形状
78
+ * */
79
+ shape?: HyApp.ShapeType;
80
+ /**
81
+ * @description 按钮点击等待时长(运用了节流方法)
82
+ * */
83
+ warn?: number;
84
+ /**
85
+ * @description 定义需要用到的外部样式
86
+ * */
87
+ customStyle?: CSSProperties;
88
+ }
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <view ref="hy-subsection__bar" :style="barStyle" :class="barClass"></view>
8
8
  <view
9
- :class="wrapperClass"
9
+ :class="wrapperClass(index)"
10
10
  :ref="`hy-subsection__item--${index}`"
11
11
  :style="itemStyle"
12
12
  @tap="clickHandler(item, index)"
@@ -21,16 +21,17 @@
21
21
  </template>
22
22
 
23
23
  <script setup lang="ts">
24
- import { computed, toRefs, ref, onMounted, watch } from "vue";
24
+ import {computed, toRefs, ref, onMounted, watch, getCurrentInstance} from "vue";
25
25
  import type { CSSProperties } from "vue";
26
26
  import defaultProps from "./props";
27
27
  import type IProps from "./typing";
28
- import type { SubSectionListVo } from "./typing";
28
+ import type { SubSectionVo } from "./typing";
29
29
  import { addUnit, getRect, guid } from "../../utils";
30
30
 
31
31
  const props = withDefaults(defineProps<IProps>(), defaultProps);
32
32
  const {
33
33
  modelValue,
34
+ current,
34
35
  list,
35
36
  mode,
36
37
  activeColor,
@@ -42,6 +43,7 @@ const {
42
43
  } = toRefs(props);
43
44
  const emit = defineEmits(["change", "update:modelValue"]);
44
45
 
46
+ const instance = getCurrentInstance();
45
47
  // 组件尺寸
46
48
  const itemRect = ref<UniApp.NodeInfo>({
47
49
  width: 0,
@@ -50,12 +52,6 @@ const itemRect = ref<UniApp.NodeInfo>({
50
52
  const innerCurrent = ref<number>(0);
51
53
  const guidClass = guid();
52
54
 
53
- watch(
54
- () => modelValue.value,
55
- (newVal: string) => {},
56
- { immediate: true },
57
- );
58
-
59
55
  /**
60
56
  * @description 容器样式
61
57
  * */
@@ -71,15 +67,16 @@ const wrapperStyle = computed<CSSProperties>(() => {
71
67
  * @description 容器类名
72
68
  * */
73
69
  const wrapperClass = computed(() => {
74
- return [
75
- "hy-subsection__item",
76
- "cursor-pointer",
77
- `hy-subsection__item--${innerCurrent.value}__${guidClass}`,
78
- innerCurrent.value < list.value.length - 1 &&
79
- "hy-subsection__item--no-border-right",
80
- innerCurrent.value === 0 && "hy-subsection__item--first",
81
- innerCurrent.value === list.value.length - 1 && "hy-subsection__item--last",
82
- ];
70
+ return (index: number) => {
71
+ return [
72
+ "hy-subsection__item",
73
+ "cursor-pointer",
74
+ `hy-subsection__item--${innerCurrent.value}__${guidClass}`,
75
+ index < list.value.length - 1 && "hy-subsection__item--no-border-right",
76
+ index === 0 && "hy-subsection__item--first",
77
+ index === list.value.length - 1 && "hy-subsection__item--last",
78
+ ];
79
+ };
83
80
  });
84
81
  /**
85
82
  * @description 滑块的样式
@@ -123,17 +120,15 @@ const barClass = computed(() => {
123
120
  /**
124
121
  * @description 分段器item的样式
125
122
  * */
126
- const itemStyle = computed(() => {
127
- return (): CSSProperties => {
128
- const style: CSSProperties = {};
129
- if (mode.value === "subsection") {
130
- // 设置border的样式
131
- style.borderColor = activeColor.value;
132
- style.borderWidth = "1px";
133
- style.borderStyle = "solid";
134
- }
135
- return style;
136
- };
123
+ const itemStyle = computed<CSSProperties>(() => {
124
+ const style: CSSProperties = {};
125
+ if (mode.value === "subsection") {
126
+ // 设置border的样式
127
+ style.borderColor = activeColor.value;
128
+ style.borderWidth = "1px";
129
+ style.borderStyle = "solid";
130
+ }
131
+ return style;
137
132
  });
138
133
  /**
139
134
  * @description 分段器文字颜色
@@ -164,18 +159,20 @@ onMounted(() => {
164
159
  * @description 初始化
165
160
  * */
166
161
  const init = () => {
167
- innerCurrent.value = list.value.findIndex(
168
- (item: string | SubSectionListVo) => {
169
- if (typeof item === "string") {
170
- return item === modelValue.value;
171
- } else {
172
- return item[fieldNames.value.value] === modelValue.value;
173
- }
174
- },
175
- );
162
+ innerCurrent.value = list.value.findIndex((item: SubSectionVo) => {
163
+ if (typeof item === "string" || typeof item === "number") {
164
+ return item === modelValue.value;
165
+ } else {
166
+ return item[fieldNames.value.value] === modelValue.value;
167
+ }
168
+ });
169
+
170
+ // 设置默认值当没有找的时候导致样式问题
171
+ innerCurrent.value =
172
+ innerCurrent.value === -1 ? current.value : innerCurrent.value;
176
173
 
177
174
  // TODO: 多个数组在一起计算宽度, 宽度不一样会有问题,所以必须加guidClass随机数
178
- getRect(`.hy-subsection__item--0__${guidClass}`).then((size) => {
175
+ getRect(`.hy-subsection__item--0__${guidClass}`, false, instance).then((size) => {
179
176
  itemRect.value = size as UniApp.NodeInfo;
180
177
  });
181
178
  };
@@ -183,21 +180,21 @@ const init = () => {
183
180
  /**
184
181
  * @description 判断值
185
182
  * */
186
- const getValue = (item: string | SubSectionListVo) => {
183
+ const getValue = (item: SubSectionVo) => {
187
184
  return typeof item === "object" ? item[fieldNames.value.value] : item;
188
185
  };
189
186
 
190
187
  /**
191
188
  * @description 判断展示文本
192
189
  * */
193
- const getName = (item: string | SubSectionListVo) => {
190
+ const getName = (item: SubSectionVo) => {
194
191
  return typeof item === "object" ? item[fieldNames.value.label] : item;
195
192
  };
196
193
 
197
194
  /**
198
195
  * @description 点击事件
199
196
  * */
200
- const clickHandler = (temp: string | SubSectionListVo, index: number) => {
197
+ const clickHandler = (temp: SubSectionVo, index: number) => {
201
198
  // 值改变才触发
202
199
  if (innerCurrent.value !== index) {
203
200
  emit("change", index);
@@ -208,94 +205,5 @@ const clickHandler = (temp: string | SubSectionListVo, index: number) => {
208
205
  </script>
209
206
 
210
207
  <style lang="scss" scoped>
211
- @import "../../libs/css/mixin.scss";
212
-
213
- .hy-subsection {
214
- @include flex;
215
- position: relative;
216
- overflow: hidden;
217
- /* #ifndef APP-NVUE */
218
- width: 100%;
219
- box-sizing: border-box;
220
- /* #endif */
221
-
222
- &--button {
223
- height: 35px;
224
- background-color: rgb(238, 238, 239);
225
- padding: 3px;
226
- border-radius: 4px;
227
- align-items: stretch;
228
-
229
- &__bar {
230
- background-color: #ffffff;
231
- border-radius: 4px !important;
232
- }
233
- }
234
-
235
- &--subsection {
236
- height: 32px;
237
- }
238
-
239
- &__bar {
240
- position: absolute;
241
- /* #ifndef APP-NVUE */
242
- transition-property: transform, color;
243
- transition-duration: 0.3s;
244
- transition-timing-function: ease-in-out;
245
- /* #endif */
246
-
247
- &--first {
248
- border-top-left-radius: 4px;
249
- border-bottom-left-radius: 4px;
250
- border-top-right-radius: 0px;
251
- border-bottom-right-radius: 0px;
252
- }
253
-
254
- &--center {
255
- border-top-left-radius: 0px;
256
- border-bottom-left-radius: 0px;
257
- border-top-right-radius: 0px;
258
- border-bottom-right-radius: 0px;
259
- }
260
-
261
- &--last {
262
- border-top-left-radius: 0px;
263
- border-bottom-left-radius: 0px;
264
- border-top-right-radius: 4px;
265
- border-bottom-right-radius: 4px;
266
- }
267
- }
268
-
269
- &__item {
270
- @include flex;
271
- flex: 1;
272
- justify-content: center;
273
- align-items: center;
274
- // vue环境下,需要设置相对定位,因为滑块为绝对定位,item需要在滑块的上面
275
- position: relative;
276
-
277
- &--no-border-right {
278
- border-right-width: 0 !important;
279
- }
280
-
281
- &--first {
282
- border-top-left-radius: 4px;
283
- border-bottom-left-radius: 4px;
284
- }
285
-
286
- &--last {
287
- border-top-right-radius: 4px;
288
- border-bottom-right-radius: 4px;
289
- }
290
-
291
- &__text {
292
- font-size: 12px;
293
- line-height: 14px;
294
- @include flex;
295
- align-items: center;
296
- transition-property: color;
297
- transition-duration: 0.3s;
298
- }
299
- }
300
- }
208
+ @import "./index.scss";
301
209
  </style>
@@ -0,0 +1,82 @@
1
+ @use "../../theme.scss" as *;
2
+ @use "../../libs/css/mixin.scss" as *;
3
+
4
+ .hy-subsection {
5
+ @include flex;
6
+ position: relative;
7
+ overflow: hidden;
8
+ /* #ifndef APP-NVUE */
9
+ width: 100%;
10
+ box-sizing: border-box;
11
+ /* #endif */
12
+
13
+ &--button {
14
+ height: 35px;
15
+ background-color: rgb(238, 238, 239);
16
+ padding: 3px;
17
+ border-radius: $hy-border-radius-sm;
18
+ align-items: stretch;
19
+
20
+ &__bar {
21
+ background-color: #ffffff;
22
+ border-radius: $hy-border-radius-sm;
23
+ }
24
+ }
25
+
26
+ &--subsection {
27
+ height: 32px;
28
+ }
29
+
30
+ &__bar {
31
+ position: absolute;
32
+ /* #ifndef APP-NVUE */
33
+ transition-property: transform, color;
34
+ transition-duration: 0.3s;
35
+ transition-timing-function: ease-in-out;
36
+ /* #endif */
37
+
38
+ &--first {
39
+ border-radius: $hy-border-radius-sm 0 0 $hy-border-radius-sm;
40
+ }
41
+
42
+ &--center {
43
+ border-radius: 0;
44
+ }
45
+
46
+ &--last {
47
+ border-radius: 0 $hy-border-radius-sm $hy-border-radius-sm 0;
48
+ }
49
+ }
50
+
51
+ &__item {
52
+ @include flex;
53
+ flex: 1;
54
+ justify-content: center;
55
+ align-items: center;
56
+ // vue环境下,需要设置相对定位,因为滑块为绝对定位,item需要在滑块的上面
57
+ position: relative;
58
+
59
+ &--no-border-right {
60
+ border-right-width: 0 !important;
61
+ }
62
+
63
+ &--first {
64
+ border-top-left-radius: $hy-border-radius-sm;
65
+ border-bottom-left-radius: $hy-border-radius-sm;
66
+ }
67
+
68
+ &--last {
69
+ border-top-right-radius: $hy-border-radius-sm;
70
+ border-bottom-right-radius: $hy-border-radius-sm;
71
+ }
72
+
73
+ &__text {
74
+ font-size: 12px;
75
+ line-height: 14px;
76
+ @include flex;
77
+ align-items: center;
78
+ transition-property: color;
79
+ transition-duration: 0.3s;
80
+ }
81
+ }
82
+ }
@@ -3,6 +3,7 @@ import { ColorConfig } from "../../config";
3
3
 
4
4
  const defaultProps: IProps = {
5
5
  modelValue: "",
6
+ current: 0,
6
7
  list: [],
7
8
  fieldNames: {
8
9
  label: "name",
@@ -1,17 +1,26 @@
1
1
  import type { CSSProperties } from "vue";
2
2
  import { HyApp } from "@/package/typing/modules/common";
3
3
 
4
- export interface SubSectionListVo extends HyApp.FieldNamesType {
4
+ export interface SubSectionItemVo extends HyApp.FieldNamesType {
5
5
  name: string;
6
- value: string;
6
+ value: string | number;
7
7
  }
8
8
 
9
+ export type SubSectionVo = string | number | SubSectionItemVo;
10
+
9
11
  export default interface IProps {
10
- modelValue: string;
12
+ /**
13
+ * @description 接收值
14
+ * */
15
+ modelValue: string | number;
16
+ /**
17
+ * @description 默认值 (默认0)
18
+ * */
19
+ current?: number;
11
20
  /**
12
21
  * @description tab的数据
13
22
  * */
14
- list: (string | SubSectionListVo)[];
23
+ list: SubSectionVo[];
15
24
  /**
16
25
  * @description list的键值
17
26
  * */