hy-app 0.1.2 → 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 (221) 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 +12 -124
  16. package/components/hy-button/index.scss +116 -0
  17. package/components/hy-calendar/header.vue +76 -0
  18. package/components/hy-calendar/hy-calendar.vue +366 -0
  19. package/components/hy-calendar/index.scss +171 -0
  20. package/components/hy-calendar/month.vue +524 -0
  21. package/components/hy-calendar/props.ts +37 -0
  22. package/components/hy-calendar/typing.d.ts +126 -0
  23. package/components/hy-card/hy-card.vue +21 -84
  24. package/components/hy-card/index.scss +57 -0
  25. package/components/hy-card/props.ts +2 -2
  26. package/components/hy-card/typing.d.ts +1 -1
  27. package/components/hy-cell/hy-cell.vue +1 -137
  28. package/components/hy-cell/index.scss +137 -0
  29. package/components/hy-check-button/hy-check-button.vue +1 -0
  30. package/components/hy-check-button/index.scss +5 -0
  31. package/components/hy-checkbox/hy-checkbox.vue +2 -95
  32. package/components/hy-checkbox/index.scss +94 -0
  33. package/components/hy-checkbox/typing.d.ts +1 -2
  34. package/components/hy-count-down/hy-count-down.vue +150 -0
  35. package/components/hy-count-down/index.scss +6 -0
  36. package/components/hy-count-down/index.ts +52 -0
  37. package/components/hy-count-down/props.ts +10 -0
  38. package/components/hy-count-down/typing.d.ts +20 -0
  39. package/components/hy-count-to/hy-count-to.vue +213 -0
  40. package/components/hy-count-to/index.scss +6 -0
  41. package/components/hy-count-to/props.ts +17 -0
  42. package/components/hy-count-to/typing.d.ts +48 -0
  43. package/components/hy-datetime-picker/hy-datetime-picker.vue +2 -28
  44. package/components/hy-datetime-picker/index.scss +28 -0
  45. package/components/hy-divider/hy-divider.vue +24 -49
  46. package/components/hy-divider/index.scss +25 -0
  47. package/components/hy-divider/props.ts +2 -2
  48. package/components/hy-divider/typing.d.ts +1 -1
  49. package/components/hy-dropdown/hy-dropdown.vue +43 -0
  50. package/components/hy-dropdown/index.scss +17 -0
  51. package/components/hy-dropdown/props.ts +17 -0
  52. package/components/hy-dropdown/typing.d.ts +48 -0
  53. package/components/hy-dropdown-item/hy-dropdown-item.vue +194 -0
  54. package/components/hy-dropdown-item/index.scss +96 -0
  55. package/components/hy-dropdown-item/props.ts +10 -0
  56. package/components/hy-dropdown-item/typing.d.ts +31 -0
  57. package/components/hy-empty/hy-empty.vue +8 -26
  58. package/components/hy-empty/index.scss +19 -0
  59. package/components/hy-empty/props.ts +2 -2
  60. package/components/hy-empty/typing.d.ts +1 -1
  61. package/components/hy-float-button/hy-float-button.vue +201 -0
  62. package/components/hy-float-button/index.scss +69 -0
  63. package/components/hy-float-button/props.ts +25 -0
  64. package/components/hy-float-button/typing.d.ts +93 -0
  65. package/components/hy-folding-panel/hy-folding-panel.vue +9 -12
  66. package/components/hy-folding-panel/index.scss +6 -0
  67. package/components/hy-folding-panel/props.ts +2 -2
  68. package/components/hy-folding-panel/typing.d.ts +2 -2
  69. package/components/hy-form/hy-form.vue +17 -34
  70. package/components/hy-form/index.scss +30 -0
  71. package/components/hy-form/props.ts +2 -0
  72. package/components/hy-form/typing.d.ts +9 -1
  73. package/components/hy-grid/hy-grid.vue +1 -43
  74. package/components/hy-grid/index.scss +40 -0
  75. package/components/hy-icon/hy-icon.vue +1 -93
  76. package/components/hy-icon/index.scss +84 -0
  77. package/components/hy-image/hy-image.vue +212 -0
  78. package/components/hy-image/index.scss +26 -0
  79. package/components/hy-image/props.ts +24 -0
  80. package/components/hy-image/typing.d.ts +76 -0
  81. package/components/hy-input/hy-input.vue +2 -72
  82. package/components/hy-input/index.scss +65 -0
  83. package/components/hy-line/hy-line.vue +4 -8
  84. package/components/hy-line/index.scss +5 -0
  85. package/components/hy-line/props.ts +3 -3
  86. package/components/hy-line/typing.d.ts +2 -2
  87. package/components/hy-line-progress/hy-line-progress.vue +15 -44
  88. package/components/hy-line-progress/index.scss +38 -0
  89. package/components/hy-line-progress/props.ts +2 -2
  90. package/components/hy-line-progress/typing.d.ts +1 -1
  91. package/components/hy-list/hy-list.vue +11 -41
  92. package/components/hy-list/index.scss +32 -0
  93. package/components/hy-list/props.ts +2 -2
  94. package/components/hy-loading/hy-loading.vue +95 -0
  95. package/components/hy-loading/index.scss +103 -0
  96. package/components/hy-loading/props.ts +17 -0
  97. package/components/hy-loading/typing.d.ts +52 -0
  98. package/components/hy-login/TheUserLogin.vue +16 -16
  99. package/components/hy-login/hy-login.vue +9 -9
  100. package/components/hy-login/props.ts +4 -4
  101. package/components/hy-modal/hy-modal.vue +11 -89
  102. package/components/hy-modal/index.scss +77 -0
  103. package/components/hy-modal/props.ts +2 -2
  104. package/components/hy-modal/typing.d.ts +1 -1
  105. package/components/hy-navbar/hy-navbar.vue +20 -92
  106. package/components/hy-navbar/index.scss +67 -0
  107. package/components/hy-navbar/props.ts +2 -2
  108. package/components/hy-navbar/typing.d.ts +1 -1
  109. package/components/hy-notice-bar/hy-column-notice.vue +11 -39
  110. package/components/hy-notice-bar/hy-notice-bar.vue +10 -12
  111. package/components/hy-notice-bar/hy-row-notice.vue +5 -56
  112. package/components/hy-notice-bar/index.scss +93 -0
  113. package/components/hy-notice-bar/props.ts +4 -2
  114. package/components/hy-notice-bar/typing.d.ts +13 -3
  115. package/components/hy-number-step/hy-number-step.vue +1 -70
  116. package/components/hy-number-step/index.scss +71 -0
  117. package/components/hy-overlay/hy-overlay.vue +2 -14
  118. package/components/hy-overlay/index.scss +9 -0
  119. package/components/hy-picker/hy-picker.vue +1 -68
  120. package/components/hy-picker/index.scss +68 -0
  121. package/components/hy-popup/hy-popup.vue +1 -74
  122. package/components/hy-popup/index.scss +60 -0
  123. package/components/hy-price/hy-price.vue +1 -11
  124. package/components/hy-price/index.scss +11 -0
  125. package/components/hy-qrcode/hy-qrcode.vue +15 -37
  126. package/components/hy-qrcode/index.scss +23 -0
  127. package/components/hy-qrcode/props.ts +2 -2
  128. package/components/hy-qrcode/typing.d.ts +2 -2
  129. package/components/hy-radio/hy-radio.vue +2 -101
  130. package/components/hy-radio/index.scss +93 -0
  131. package/components/hy-radio/typing.d.ts +1 -2
  132. package/components/hy-rate/hy-rate.vue +1 -33
  133. package/components/hy-rate/index.scss +33 -0
  134. package/components/hy-read-more/hy-read-more.vue +7 -30
  135. package/components/hy-read-more/index.scss +25 -0
  136. package/components/hy-read-more/props.ts +3 -3
  137. package/components/hy-read-more/typing.d.ts +1 -1
  138. package/components/hy-safe-bottom/hy-safe-bottom.vue +5 -9
  139. package/components/hy-safe-bottom/index.scss +5 -0
  140. package/components/hy-scroll-list/hy-scroll-list.vue +13 -43
  141. package/components/hy-scroll-list/index.scss +34 -0
  142. package/components/hy-scroll-list/props.ts +2 -2
  143. package/components/hy-scroll-list/typing.d.ts +1 -1
  144. package/components/hy-search/hy-search.vue +1 -83
  145. package/components/hy-search/index.scss +83 -0
  146. package/components/hy-slider/hy-slider.vue +14 -92
  147. package/components/hy-slider/index.scss +77 -0
  148. package/components/hy-status-bar/hy-status-bar.vue +41 -0
  149. package/components/hy-status-bar/index.scss +6 -0
  150. package/components/hy-status-bar/props.ts +8 -0
  151. package/components/hy-status-bar/typing.d.ts +12 -0
  152. package/components/hy-steps/hy-steps.vue +36 -163
  153. package/components/hy-steps/index.scss +131 -0
  154. package/components/hy-steps/props.ts +2 -2
  155. package/components/hy-steps/typing.d.ts +2 -2
  156. package/components/hy-subsection/hy-subsection.vue +40 -132
  157. package/components/hy-subsection/index.scss +82 -0
  158. package/components/hy-subsection/props.ts +1 -0
  159. package/components/hy-subsection/typing.d.ts +13 -4
  160. package/components/hy-swipe-action/hy-swipe-action.vue +294 -0
  161. package/components/hy-swipe-action/index.scss +9 -0
  162. package/components/hy-swipe-action/index.wxs +235 -0
  163. package/components/hy-swipe-action/props.ts +16 -0
  164. package/components/hy-swipe-action/typing.d.ts +55 -0
  165. package/components/hy-swipe-action/wxs.js +15 -0
  166. package/components/hy-swiper/hy-swiper-indicator.vue +5 -35
  167. package/components/hy-swiper/hy-swiper.vue +1 -54
  168. package/components/hy-swiper/index.scss +82 -0
  169. package/components/hy-switch/hy-switch.vue +62 -72
  170. package/components/hy-switch/index.scss +46 -0
  171. package/components/hy-switch/props.ts +4 -1
  172. package/components/hy-switch/typing.d.ts +14 -1
  173. package/components/hy-tabs/hy-tabs.vue +22 -81
  174. package/components/hy-tabs/index.scss +63 -0
  175. package/components/hy-tabs/props.ts +5 -5
  176. package/components/hy-tabs/typing.d.ts +1 -1
  177. package/components/hy-tag/hy-tag.vue +1 -214
  178. package/components/hy-tag/index.scss +204 -0
  179. package/components/hy-text/hy-text.vue +238 -0
  180. package/components/hy-text/index.scss +70 -0
  181. package/components/hy-text/index.ts +0 -0
  182. package/components/hy-text/props.ts +30 -0
  183. package/components/hy-text/typing.d.ts +98 -0
  184. package/components/hy-textarea/hy-textarea.vue +1 -46
  185. package/components/hy-textarea/index.scss +40 -0
  186. package/components/hy-tooltip/hy-tooltip.vue +42 -95
  187. package/components/hy-tooltip/index.scss +64 -0
  188. package/components/hy-tooltip/props.ts +2 -2
  189. package/components/hy-tooltip/typing.d.ts +1 -1
  190. package/components/hy-transition/hy-transition.vue +4 -2
  191. package/components/hy-transition/typing.d.ts +1 -13
  192. package/components/hy-upload/hy-upload.vue +37 -182
  193. package/components/hy-upload/index.scss +147 -0
  194. package/components/hy-upload/props.ts +2 -2
  195. package/components/hy-upload/typing.d.ts +11 -11
  196. package/components/hy-warn/hy-warn.vue +15 -123
  197. package/components/hy-warn/index.scss +109 -0
  198. package/components/hy-warn/props.ts +3 -3
  199. package/components/hy-warn/typing.d.ts +4 -3
  200. package/components/hy-waterfall/index.scss +82 -0
  201. package/components/index.ts +25 -1
  202. package/components/message/index.ts +54 -54
  203. package/config/color.ts +2 -1
  204. package/global/index.ts +6 -6
  205. package/global/register-properties.ts +2 -2
  206. package/index.scss +2 -1
  207. package/libs/css/common.scss +14 -2
  208. package/package.json +2 -2
  209. package/{libs/css → public/font}/iconfont.css +4 -4
  210. package/theme.scss +6 -4
  211. package/typing/modules/common.d.ts +16 -1
  212. package/utils/calendar.js +1021 -0
  213. package/utils/colorGradient.ts +112 -0
  214. package/utils/index.ts +2 -0
  215. package/utils/inside.ts +80 -34
  216. package/utils/inspect.ts +66 -0
  217. package/utils/utils.ts +11 -12
  218. package/libs/css/download.zip +0 -0
  219. /package/{libs/css → public/font}/iconfont.ttf +0 -0
  220. /package/{libs/css → public/font}/iconfont.woff +0 -0
  221. /package/{libs/css → public/font}/iconfont.woff2 +0 -0
@@ -4,18 +4,16 @@
4
4
  class="hy-navbar__placeholder"
5
5
  v-if="fixed && placeholder"
6
6
  :style="{
7
- height: addUnit(getPx(height) + statusBarHeight)
7
+ height: addUnit(getPx(height) + statusBarHeight),
8
8
  }"
9
9
  ></view>
10
- <view
11
- :class="[fixed && 'hy-navbar--fixed']"
12
- :style="{ paddingTop: addUnit(safeAreaInsets?.top) }"
13
- >
10
+ <view :class="[fixed && 'hy-navbar--fixed']">
11
+ <HyStatusBar v-if="safeAreaInsetTop" :bgColor="bgColor"></HyStatusBar>
14
12
  <view
15
- :class="[border && 'hy-border-bottom', 'hy-navbar__content']"
13
+ :class="[border && 'hy-border__bottom', 'hy-navbar__content']"
16
14
  :style="{
17
15
  height: addUnit(height),
18
- backgroundColor: bgColor
16
+ backgroundColor: bgColor,
19
17
  }"
20
18
  >
21
19
  <view
@@ -34,7 +32,7 @@
34
32
  <text
35
33
  v-if="leftText"
36
34
  :style="{
37
- color: leftIconColor
35
+ color: leftIconColor,
38
36
  }"
39
37
  class="hy-navbar__content__left__text"
40
38
  >{{ leftText }}</text
@@ -48,9 +46,9 @@
48
46
  :style="[
49
47
  {
50
48
  width: addUnit(titleWidth),
51
- color: titleColor
49
+ color: titleColor,
52
50
  },
53
- titleStyle
51
+ titleStyle,
54
52
  ]"
55
53
  >{{ title }}</text
56
54
  >
@@ -59,9 +57,9 @@
59
57
  :style="[
60
58
  {
61
59
  width: addUnit(titleWidth),
62
- color: titleColor
60
+ color: titleColor,
63
61
  },
64
- titleStyle
62
+ titleStyle,
65
63
  ]"
66
64
  >{{ sub }}</text
67
65
  >
@@ -86,17 +84,20 @@
86
84
 
87
85
  <script setup lang="ts">
88
86
  import defaultProps from "./props";
89
- import IProps from "./typing";
90
- import { addUnit, getPx } from "../../utils";
87
+ import type IProps from "./typing";
88
+ import { addUnit, getPx, getWindowInfo } from "../../utils";
91
89
 
92
90
  // 组件
93
91
  import HyIcon from "../hy-icon/hy-icon.vue";
92
+ import HyStatusBar from "../hy-status-bar/hy-status-bar.vue";
93
+ import { toRefs } from "vue";
94
94
 
95
95
  const props = withDefaults(defineProps<IProps>(), defaultProps);
96
+ const { autoBack, fixed } = toRefs(props);
96
97
  const emit = defineEmits(["leftClick", "rightClick"]);
97
98
 
98
- const { safeAreaInsets } = uni.getSystemSetting();
99
- const { statusBarHeight } = uni.getWindowInfo();
99
+ // 获取状态栏高度
100
+ const { statusBarHeight } = getWindowInfo();
100
101
 
101
102
  /**
102
103
  * @description 点击左侧区域
@@ -104,12 +105,8 @@ const { statusBarHeight } = uni.getWindowInfo();
104
105
  const leftClick = () => {
105
106
  // 如果配置了autoBack,自动返回上一页
106
107
  emit("leftClick");
107
- if (config.interceptor.navbarLeftClick != null) {
108
- config.interceptor.navbarLeftClick();
109
- } else {
110
- if (this.autoBack) {
111
- uni.navigateBack();
112
- }
108
+ if (autoBack.value) {
109
+ uni.navigateBack();
113
110
  }
114
111
  };
115
112
  /**
@@ -121,74 +118,5 @@ const rightClick = () => {
121
118
  </script>
122
119
 
123
120
  <style lang="scss" scoped>
124
- @import "../../libs/css/mixin.scss";
125
- @import "../../theme.scss";
126
-
127
- .hy-navbar {
128
- &--fixed {
129
- position: fixed;
130
- left: 0;
131
- right: 0;
132
- top: 0;
133
- z-index: 11;
134
- }
135
-
136
- &__content {
137
- @include flex(row);
138
- align-items: center;
139
- height: 44px;
140
- background-color: #9acafc;
141
- position: relative;
142
- justify-content: center;
143
-
144
- &__left,
145
- &__right {
146
- padding: 0 13px;
147
- position: absolute;
148
- top: 0;
149
- bottom: 0;
150
- @include flex(row);
151
- align-items: center;
152
- }
153
-
154
- &__left {
155
- left: 0;
156
-
157
- &--hover {
158
- opacity: 0.7;
159
- }
160
-
161
- &__text {
162
- font-size: 15px;
163
- margin-left: 3px;
164
- }
165
- }
166
-
167
- &__center {
168
- display: flex;
169
- flex-direction: column;
170
- text-align: center;
171
- &--title {
172
- font-size: $hy-font-size-subtitle;
173
- color: $hy-color-title;
174
- }
175
- &--sub {
176
- font-size: $hy-font-size-hint;
177
- color: $hy-color-hint;
178
- }
179
- }
180
-
181
- &__right {
182
- right: 0;
183
-
184
- &__text {
185
- font-size: 15px;
186
- margin-left: 3px;
187
- }
188
- }
189
- }
190
- }
191
- .hy-border-bottom {
192
- border-bottom: $hy-border-line;
193
- }
121
+ @import "./index.scss";
194
122
  </style>
@@ -0,0 +1,67 @@
1
+ @use "../../theme.scss" as *;
2
+ @use "../../libs/css/mixin.scss" as *;
3
+
4
+ .hy-navbar {
5
+ &--fixed {
6
+ position: fixed;
7
+ left: 0;
8
+ right: 0;
9
+ top: 0;
10
+ z-index: 11;
11
+ }
12
+
13
+ &__content {
14
+ @include flex(row);
15
+ align-items: center;
16
+ height: 44px;
17
+ background-color: #9acafc;
18
+ position: relative;
19
+ justify-content: center;
20
+
21
+ &__left,
22
+ &__right {
23
+ padding: 0 13px;
24
+ position: absolute;
25
+ top: 0;
26
+ bottom: 0;
27
+ @include flex(row);
28
+ align-items: center;
29
+ }
30
+
31
+ &__left {
32
+ left: 0;
33
+
34
+ &--hover {
35
+ opacity: 0.7;
36
+ }
37
+
38
+ &__text {
39
+ font-size: 15px;
40
+ margin-left: 3px;
41
+ }
42
+ }
43
+
44
+ &__center {
45
+ display: flex;
46
+ flex-direction: column;
47
+ text-align: center;
48
+ &--title {
49
+ font-size: $hy-font-size-subtitle;
50
+ color: $hy-color-title;
51
+ }
52
+ &--sub {
53
+ font-size: $hy-font-size-hint;
54
+ color: $hy-color-hint;
55
+ }
56
+ }
57
+
58
+ &__right {
59
+ right: 0;
60
+
61
+ &__text {
62
+ font-size: 15px;
63
+ margin-left: 3px;
64
+ }
65
+ }
66
+ }
67
+ }
@@ -1,4 +1,4 @@
1
- import IProps from "./typing";
1
+ import type IProps from "./typing";
2
2
  import { IconConfig } from "../../config";
3
3
 
4
4
  const defaultProps: IProps = {
@@ -18,7 +18,7 @@ const defaultProps: IProps = {
18
18
  height: "44px",
19
19
  leftIconSize: 20,
20
20
  leftIconColor: "",
21
- autoBack: false
21
+ autoBack: false,
22
22
  };
23
23
 
24
24
  export default defaultProps;
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from "vue";
1
+ import type { CSSProperties } from "vue";
2
2
  import { IconConfig } from "../../config";
3
3
 
4
4
  export default interface IProps {
@@ -48,12 +48,13 @@
48
48
  </template>
49
49
 
50
50
  <script setup lang="ts">
51
- import { CSSProperties, toRefs, computed, ref } from "vue";
52
- import IProps from "./typing";
51
+ import { type CSSProperties, toRefs, computed, ref, watch } from "vue";
52
+ import type IProps from "./typing";
53
53
  import defaultProps from "./props";
54
- import { addUnit } from "../../utils";
54
+ import { addUnit, error } from "../../utils";
55
55
  import { IconConfig } from "../../config";
56
56
 
57
+ // 组件
57
58
  import HyIcon from "../hy-icon/hy-icon.vue";
58
59
 
59
60
  const props = withDefaults(defineProps<IProps>(), defaultProps);
@@ -62,6 +63,12 @@ const emit = defineEmits(["click", "close"]);
62
63
 
63
64
  const index = ref(0);
64
65
 
66
+ watch(
67
+ () => text.value,
68
+ (newVal) => !Array.isArray(newVal) && error("传入值必须是数组"),
69
+ { immediate: true },
70
+ );
71
+
65
72
  /**
66
73
  * @description 文字内容的样式
67
74
  * */
@@ -91,40 +98,5 @@ const close = () => {
91
98
  </script>
92
99
 
93
100
  <style lang="scss" scoped>
94
- @import "../../libs/css/mixin.scss";
95
- @import "../../theme.scss";
96
-
97
- .hy-notice {
98
- @include flex;
99
- align-items: center;
100
- justify-content: space-between;
101
-
102
- &__left-icon {
103
- align-items: center;
104
- margin-right: 5px;
105
- }
106
-
107
- &__right-icon {
108
- margin-left: 5px;
109
- align-items: center;
110
- }
111
-
112
- &__swiper {
113
- height: 16px;
114
- @include flex;
115
- align-items: center;
116
- flex: 1;
117
-
118
- &__item {
119
- @include flex;
120
- align-items: center;
121
- overflow: hidden;
122
-
123
- &__text {
124
- font-size: 14px;
125
- color: $hy-warning;
126
- }
127
- }
128
- }
129
- }
101
+ @import "./index.scss";
130
102
  </style>
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <view
3
- class="u-notice-bar"
3
+ class="hy-notice-bar"
4
4
  v-if="show"
5
5
  :style="[
6
6
  {
7
- backgroundColor: bgColor
7
+ backgroundColor: bgColor,
8
8
  },
9
- customStyle
9
+ customStyle,
10
10
  ]"
11
11
  >
12
12
  <template v-if="direction === 'column' || (direction === 'row' && step)">
@@ -44,9 +44,9 @@
44
44
  </template>
45
45
 
46
46
  <script setup lang="ts">
47
- import { ref } from "vue";
47
+ import { ref, toRefs } from "vue";
48
48
  import defaultProps from "./props";
49
- import IProps from "./typing";
49
+ import type IProps from "./typing";
50
50
  // 组件
51
51
  import HyRowNotice from "./hy-row-notice.vue";
52
52
  import HyColumnNotice from "./hy-column-notice.vue";
@@ -54,6 +54,7 @@ import HyColumnNotice from "./hy-column-notice.vue";
54
54
  const show = ref(true);
55
55
 
56
56
  const props = withDefaults(defineProps<IProps>(), defaultProps);
57
+ const { mode, linkType, url } = toRefs(props);
57
58
  const emit = defineEmits(["click", "close"]);
58
59
 
59
60
  /**
@@ -61,6 +62,9 @@ const emit = defineEmits(["click", "close"]);
61
62
  * */
62
63
  const click = (index: number) => {
63
64
  emit("click", index);
65
+ if (url.value && linkType.value && mode.value === "link") {
66
+ (uni as any)[linkType.value]({ url: url.value });
67
+ }
64
68
  };
65
69
  /**
66
70
  * @description 点击关闭按钮
@@ -72,11 +76,5 @@ const close = () => {
72
76
  </script>
73
77
 
74
78
  <style lang="scss" scoped>
75
- @import "../../libs/css/mixin.scss";
76
-
77
- .u-notice-bar {
78
- overflow: hidden;
79
- padding: 9px 12px;
80
- flex: 1;
81
- }
79
+ @import "./index.scss";
82
80
  </style>
@@ -41,8 +41,8 @@
41
41
  </template>
42
42
 
43
43
  <script setup lang="ts">
44
- import { ref, watch, toRefs, computed, CSSProperties } from "vue";
45
- import IProps from "./typing";
44
+ import { ref, watch, toRefs, computed, type CSSProperties } from "vue";
45
+ import type IProps from "./typing";
46
46
  import defaultProps from "./props";
47
47
  import { addUnit, getRect, sleep } from "../../utils";
48
48
  import { IconConfig } from "../../config";
@@ -60,7 +60,7 @@ const initValue = ref<string>("");
60
60
  watch(
61
61
  () => text.value,
62
62
  async (newValue) => {
63
- if (Array.isArray(newValue)) initValue.value = newValue.join("");
63
+ initValue.value = Array.isArray(newValue) ? newValue.join("") : newValue;
64
64
  let boxWidth = 0,
65
65
  textWidth = 0;
66
66
  // 进行一定的延时
@@ -76,7 +76,7 @@ watch(
76
76
  await sleep(10);
77
77
  animationPlayState.value = "running";
78
78
  },
79
- { immediate: true }
79
+ { immediate: true },
80
80
  );
81
81
 
82
82
  /**
@@ -127,56 +127,5 @@ const close = () => {
127
127
  </script>
128
128
 
129
129
  <style lang="scss" scoped>
130
- @import "../../libs/css/mixin.scss";
131
- @import "../../theme.scss";
132
-
133
- .hy-notice {
134
- @include flex;
135
- align-items: center;
136
- justify-content: space-between;
137
-
138
- &__left-icon {
139
- align-items: center;
140
- margin-right: 5px;
141
- }
142
-
143
- &__right-icon {
144
- margin-left: 5px;
145
- align-items: center;
146
- }
147
-
148
- &__content {
149
- text-align: right;
150
- flex: 1;
151
- @include flex;
152
- flex-wrap: nowrap;
153
- overflow: hidden;
154
-
155
- &__text {
156
- font-size: 14px;
157
- color: $hy-warning;
158
- /* #ifndef APP-NVUE */
159
- // 这一句很重要,为了能让滚动左右连接起来
160
- padding-left: 100%;
161
- word-break: keep-all;
162
- white-space: nowrap;
163
- animation: hy-loop-animation 10s linear infinite both;
164
- /* #endif */
165
- @include flex(row);
166
- line-height: 100%;
167
- }
168
- }
169
- }
170
-
171
- /* #ifndef APP-NVUE */
172
- @keyframes hy-loop-animation {
173
- 0% {
174
- transform: translate3d(0, 0, 0);
175
- }
176
-
177
- 100% {
178
- transform: translate3d(-100%, 0, 0);
179
- }
180
- }
181
- /* #endif */
130
+ @import "./index.scss";
182
131
  </style>
@@ -0,0 +1,93 @@
1
+ @use "../../theme.scss" as *;
2
+ @use "../../libs/css/mixin.scss" as *;
3
+
4
+
5
+ .hy-notice {
6
+ @include flex;
7
+ align-items: center;
8
+ justify-content: space-between;
9
+
10
+ &__left-icon {
11
+ align-items: center;
12
+ margin-right: 5px;
13
+ }
14
+
15
+ &__right-icon {
16
+ margin-left: 5px;
17
+ align-items: center;
18
+ }
19
+
20
+ &__content {
21
+ text-align: right;
22
+ flex: 1;
23
+ @include flex;
24
+ flex-wrap: nowrap;
25
+ overflow: hidden;
26
+
27
+ &__text {
28
+ font-size: 14px;
29
+ color: $hy-warning;
30
+ /* #ifndef APP-NVUE */
31
+ // 这一句很重要,为了能让滚动左右连接起来
32
+ padding-left: 100%;
33
+ word-break: keep-all;
34
+ white-space: nowrap;
35
+ animation: hy-loop-animation 10s linear infinite both;
36
+ /* #endif */
37
+ @include flex(row);
38
+ line-height: 100%;
39
+ }
40
+ }
41
+ }
42
+
43
+ /* #ifndef APP-NVUE */
44
+ @keyframes hy-loop-animation {
45
+ 0% {
46
+ transform: translate3d(0, 0, 0);
47
+ }
48
+
49
+ 100% {
50
+ transform: translate3d(-100%, 0, 0);
51
+ }
52
+ }
53
+ /* #endif */
54
+
55
+ .hy-notice-bar {
56
+ overflow: hidden;
57
+ padding: 9px 12px;
58
+ flex: 1;
59
+ }
60
+
61
+ .hy-notice {
62
+ @include flex;
63
+ align-items: center;
64
+ justify-content: space-between;
65
+
66
+ &__left-icon {
67
+ align-items: center;
68
+ margin-right: 5px;
69
+ }
70
+
71
+ &__right-icon {
72
+ margin-left: 5px;
73
+ align-items: center;
74
+ }
75
+
76
+ &__swiper {
77
+ height: 16px;
78
+ @include flex;
79
+ align-items: center;
80
+ flex: 1;
81
+
82
+ &__item {
83
+ @include flex;
84
+ align-items: center;
85
+ overflow: hidden;
86
+
87
+ &__text {
88
+ font-size: 14px;
89
+ color: $hy-warning;
90
+ }
91
+ }
92
+ }
93
+ }
@@ -1,4 +1,4 @@
1
- import IProps from "./typing";
1
+ import type IProps from "./typing";
2
2
  import { IconConfig } from "../../config";
3
3
 
4
4
  const defaultProps: IProps = {
@@ -13,7 +13,9 @@ const defaultProps: IProps = {
13
13
  fontSize: 14,
14
14
  duration: 2000,
15
15
  disableTouch: true,
16
- justifyContent: "flex-start"
16
+ justifyContent: "flex-start",
17
+ linkType: "navigateTo",
18
+ url: "",
17
19
  };
18
20
 
19
21
  export default defaultProps;
@@ -1,4 +1,6 @@
1
- import { CSSProperties } from "vue";
1
+ import type { CSSProperties } from "vue";
2
+
3
+ export type NoticeBarModeVo = "closable" | "link" | "";
2
4
 
3
5
  export default interface IProps {
4
6
  /**
@@ -8,7 +10,7 @@ export default interface IProps {
8
10
  /**
9
11
  * @description 通告滚动模式,row-横向滚动,column-竖向滚动 ( 默认 'row' )
10
12
  * */
11
- direction?: HyApp.PermutationType;
13
+ direction?: HyApp.DirectionType;
12
14
  /**
13
15
  * @description direction = row时,是否使用步进形式滚动 ( 默认 false )
14
16
  * */
@@ -20,7 +22,7 @@ export default interface IProps {
20
22
  /**
21
23
  * @description 通告模式,link-显示右箭头,closable-显示右侧关闭图标
22
24
  * */
23
- mode?: "closable" | "link" | "";
25
+ mode?: NoticeBarModeVo;
24
26
  /**
25
27
  * @description 文字颜色,各图标也会使用文字颜色 ( 默认 '#f9ae3d' )
26
28
  * */
@@ -49,6 +51,14 @@ export default interface IProps {
49
51
  * @description 分布
50
52
  * */
51
53
  justifyContent?: HyApp.JustifyContentType;
54
+ /**
55
+ * @description 跳转类型
56
+ * */
57
+ linkType?: HyApp.NavigationType;
58
+ /**
59
+ * @description 跳转地址
60
+ * */
61
+ url?: string;
52
62
  /**
53
63
  * @description 定义需要用到的外部样式
54
64
  * */
@@ -374,74 +374,5 @@ const onClearTimeout = () => {
374
374
  </script>
375
375
 
376
376
  <style lang="scss" scoped>
377
- @import "../../libs/css/mixin.scss";
378
-
379
- $u-numberBox-hover-bgColor: #e6e6e6 !default;
380
- $u-numberBox-disabled-color: #c8c9cc !default;
381
- $u-numberBox-disabled-bgColor: #f7f8fa !default;
382
- $u-numberBox-plus-radius: 4px !default;
383
- $u-numberBox-minus-radius: 4px !default;
384
- $u-numberBox-input-text-align: center !default;
385
- $u-numberBox-input-font-size: 15px !default;
386
- $u-numberBox-input-padding: 0 !default;
387
- $u-numberBox-input-margin: 0 2px !default;
388
- $u-numberBox-input-disabled-color: #c8c9cc !default;
389
- $u-numberBox-input-disabled-bgColor: #f2f3f5 !default;
390
-
391
- .hy-number-box {
392
- @include flex(row);
393
- align-items: center;
394
-
395
- &__slot {
396
- /* #ifndef APP-NVUE */
397
- touch-action: none;
398
- /* #endif */
399
- }
400
-
401
- &__plus,
402
- &__minus {
403
- width: 35px;
404
- @include flex;
405
- justify-content: center;
406
- align-items: center;
407
- /* #ifndef APP-NVUE */
408
- touch-action: none;
409
- /* #endif */
410
-
411
- &--hover {
412
- background-color: $u-numberBox-hover-bgColor !important;
413
- }
414
-
415
- &--disabled {
416
- color: $u-numberBox-disabled-color;
417
- background-color: $u-numberBox-disabled-bgColor;
418
- }
419
- }
420
-
421
- &__plus {
422
- border-top-right-radius: $u-numberBox-plus-radius;
423
- border-bottom-right-radius: $u-numberBox-plus-radius;
424
- }
425
-
426
- &__minus {
427
- border-top-left-radius: $u-numberBox-minus-radius;
428
- border-bottom-left-radius: $u-numberBox-minus-radius;
429
- }
430
-
431
- &__input {
432
- position: relative;
433
- text-align: $u-numberBox-input-text-align;
434
- font-size: $u-numberBox-input-font-size;
435
- padding: $u-numberBox-input-padding;
436
- margin: $u-numberBox-input-margin;
437
- @include flex;
438
- align-items: center;
439
- justify-content: center;
440
-
441
- &--disabled {
442
- color: $u-numberBox-input-disabled-color;
443
- background-color: $u-numberBox-input-disabled-bgColor;
444
- }
445
- }
446
- }
377
+ @import "./index.scss";
447
378
  </style>