hy-app 0.1.1

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 (206) hide show
  1. package/README.md +42 -0
  2. package/api/http.ts +138 -0
  3. package/api/index.ts +1 -0
  4. package/common/index.ts +1 -0
  5. package/common/versionControl.ts +102 -0
  6. package/components/dialog/TheDialog.vue +128 -0
  7. package/components/dialog/index.ts +38 -0
  8. package/components/hy-address-picker/hy-address-picker.vue +262 -0
  9. package/components/hy-address-picker/props.ts +27 -0
  10. package/components/hy-address-picker/typing.d.ts +98 -0
  11. package/components/hy-avatar/hy-avatar.vue +217 -0
  12. package/components/hy-avatar/props.ts +20 -0
  13. package/components/hy-avatar/typing.d.ts +64 -0
  14. package/components/hy-back-top/hy-back-top.vue +71 -0
  15. package/components/hy-back-top/props.ts +23 -0
  16. package/components/hy-back-top/typing.d.ts +49 -0
  17. package/components/hy-badge/hy-badge.vue +155 -0
  18. package/components/hy-badge/props.ts +19 -0
  19. package/components/hy-badge/typing.d.ts +60 -0
  20. package/components/hy-button/hy-button.vue +394 -0
  21. package/components/hy-button/props.ts +36 -0
  22. package/components/hy-button/typing.d.ts +125 -0
  23. package/components/hy-card/hy-card.vue +198 -0
  24. package/components/hy-card/props.ts +29 -0
  25. package/components/hy-card/typing.d.ts +112 -0
  26. package/components/hy-cell/hy-cell.vue +268 -0
  27. package/components/hy-cell/props.ts +20 -0
  28. package/components/hy-cell/typing.d.ts +98 -0
  29. package/components/hy-check-button/hy-check-button.vue +71 -0
  30. package/components/hy-check-button/props.ts +20 -0
  31. package/components/hy-check-button/typing.d.ts +79 -0
  32. package/components/hy-checkbox/hy-checkbox.vue +299 -0
  33. package/components/hy-checkbox/props.ts +28 -0
  34. package/components/hy-checkbox/typing.d.ts +77 -0
  35. package/components/hy-datetime-picker/hy-datetime-picker.vue +584 -0
  36. package/components/hy-datetime-picker/props.ts +36 -0
  37. package/components/hy-datetime-picker/typing.d.ts +135 -0
  38. package/components/hy-divider/hy-divider.vue +164 -0
  39. package/components/hy-divider/props.ts +21 -0
  40. package/components/hy-divider/typing.d.ts +64 -0
  41. package/components/hy-empty/hy-empty.vue +122 -0
  42. package/components/hy-empty/props.ts +21 -0
  43. package/components/hy-empty/typing.d.ts +68 -0
  44. package/components/hy-folding-panel/hy-folding-panel.vue +94 -0
  45. package/components/hy-folding-panel/props.ts +17 -0
  46. package/components/hy-folding-panel/typing.d.ts +59 -0
  47. package/components/hy-form/hy-form.vue +372 -0
  48. package/components/hy-form/props.ts +15 -0
  49. package/components/hy-form/typing.d.ts +51 -0
  50. package/components/hy-grid/hy-grid.vue +126 -0
  51. package/components/hy-grid/props.ts +16 -0
  52. package/components/hy-grid/typing.d.ts +62 -0
  53. package/components/hy-icon/hy-icon.vue +207 -0
  54. package/components/hy-icon/props.ts +24 -0
  55. package/components/hy-icon/typing.d.ts +80 -0
  56. package/components/hy-input/hy-input.vue +402 -0
  57. package/components/hy-input/props.ts +41 -0
  58. package/components/hy-input/typing.d.ts +148 -0
  59. package/components/hy-line/hy-line.vue +44 -0
  60. package/components/hy-line/props.ts +12 -0
  61. package/components/hy-line/typing.d.ts +32 -0
  62. package/components/hy-line-progress/hy-line-progress.vue +118 -0
  63. package/components/hy-line-progress/props.ts +12 -0
  64. package/components/hy-line-progress/typing.d.ts +28 -0
  65. package/components/hy-list/hy-list.vue +250 -0
  66. package/components/hy-list/props.ts +18 -0
  67. package/components/hy-list/typing.d.ts +50 -0
  68. package/components/hy-login/ThePhoneLogin.vue +106 -0
  69. package/components/hy-login/TheUserLogin.vue +391 -0
  70. package/components/hy-login/hy-login.vue +283 -0
  71. package/components/hy-login/props.ts +32 -0
  72. package/components/hy-login/typing.d.ts +60 -0
  73. package/components/hy-modal/hy-modal.vue +240 -0
  74. package/components/hy-modal/props.ts +24 -0
  75. package/components/hy-modal/typing.d.ts +70 -0
  76. package/components/hy-navbar/hy-navbar.vue +194 -0
  77. package/components/hy-navbar/props.ts +24 -0
  78. package/components/hy-navbar/typing.d.ts +81 -0
  79. package/components/hy-notice-bar/hy-column-notice.vue +130 -0
  80. package/components/hy-notice-bar/hy-notice-bar.vue +82 -0
  81. package/components/hy-notice-bar/hy-row-notice.vue +182 -0
  82. package/components/hy-notice-bar/props.ts +19 -0
  83. package/components/hy-notice-bar/typing.d.ts +56 -0
  84. package/components/hy-number-step/hy-number-step.vue +428 -0
  85. package/components/hy-number-step/props.ts +29 -0
  86. package/components/hy-number-step/typing.d.ts +104 -0
  87. package/components/hy-overlay/hy-overlay.vue +54 -0
  88. package/components/hy-overlay/props.ts +10 -0
  89. package/components/hy-overlay/typing.d.ts +24 -0
  90. package/components/hy-picker/hy-picker.vue +499 -0
  91. package/components/hy-picker/props.ts +30 -0
  92. package/components/hy-picker/typing.d.ts +115 -0
  93. package/components/hy-popup/hy-popup.vue +269 -0
  94. package/components/hy-popup/props.ts +21 -0
  95. package/components/hy-popup/typing.d.ts +68 -0
  96. package/components/hy-price/hy-price.vue +86 -0
  97. package/components/hy-price/props.ts +13 -0
  98. package/components/hy-price/typing.d.ts +36 -0
  99. package/components/hy-qrcode/hy-qrcode.vue +153 -0
  100. package/components/hy-qrcode/props.ts +20 -0
  101. package/components/hy-qrcode/qrcode.js +1364 -0
  102. package/components/hy-qrcode/typing.d.ts +64 -0
  103. package/components/hy-radio/hy-radio.vue +319 -0
  104. package/components/hy-radio/props.ts +28 -0
  105. package/components/hy-radio/typing.d.ts +85 -0
  106. package/components/hy-rate/hy-rate.vue +261 -0
  107. package/components/hy-rate/props.ts +18 -0
  108. package/components/hy-rate/typing.d.ts +60 -0
  109. package/components/hy-read-more/hy-read-more.vue +134 -0
  110. package/components/hy-read-more/props.ts +20 -0
  111. package/components/hy-read-more/typing.d.ts +44 -0
  112. package/components/hy-safe-bottom/hy-safe-bottom.vue +64 -0
  113. package/components/hy-scroll-list/hy-scroll-list.vue +146 -0
  114. package/components/hy-scroll-list/props.ts +12 -0
  115. package/components/hy-scroll-list/typing.d.ts +28 -0
  116. package/components/hy-search/hy-search.vue +294 -0
  117. package/components/hy-search/props.ts +29 -0
  118. package/components/hy-search/typing.d.ts +109 -0
  119. package/components/hy-slider/hy-slider.vue +511 -0
  120. package/components/hy-slider/props.ts +21 -0
  121. package/components/hy-slider/typing.d.ts +68 -0
  122. package/components/hy-steps/hy-steps.vue +352 -0
  123. package/components/hy-steps/props.ts +15 -0
  124. package/components/hy-steps/typing.d.ts +58 -0
  125. package/components/hy-subsection/hy-subsection.vue +272 -0
  126. package/components/hy-subsection/props.ts +16 -0
  127. package/components/hy-subsection/typing.d.ts +44 -0
  128. package/components/hy-swiper/hy-swiper-indicator.vue +105 -0
  129. package/components/hy-swiper/hy-swiper.vue +242 -0
  130. package/components/hy-swiper/props.ts +30 -0
  131. package/components/hy-swiper/typing.d.ts +107 -0
  132. package/components/hy-switch/hy-switch.vue +168 -0
  133. package/components/hy-switch/props.ts +16 -0
  134. package/components/hy-switch/typing.d.ts +48 -0
  135. package/components/hy-tabs/hy-tabs.vue +416 -0
  136. package/components/hy-tabs/props.ts +26 -0
  137. package/components/hy-tabs/typing.d.ts +86 -0
  138. package/components/hy-tag/hy-tag.vue +374 -0
  139. package/components/hy-tag/props.ts +22 -0
  140. package/components/hy-tag/typing.d.ts +76 -0
  141. package/components/hy-textarea/hy-textarea.vue +229 -0
  142. package/components/hy-textarea/props.ts +26 -0
  143. package/components/hy-textarea/typing.d.ts +27 -0
  144. package/components/hy-tooltip/hy-tooltip.vue +332 -0
  145. package/components/hy-tooltip/props.ts +17 -0
  146. package/components/hy-tooltip/typing.d.ts +52 -0
  147. package/components/hy-transition/hy-transition.vue +150 -0
  148. package/components/hy-transition/index.scss +113 -0
  149. package/components/hy-transition/props.ts +10 -0
  150. package/components/hy-transition/typing.d.ts +36 -0
  151. package/components/hy-upload/hy-upload.vue +557 -0
  152. package/components/hy-upload/props.ts +29 -0
  153. package/components/hy-upload/typing.d.ts +147 -0
  154. package/components/hy-warn/hy-warn.vue +228 -0
  155. package/components/hy-warn/props.ts +14 -0
  156. package/components/hy-warn/typing.d.ts +40 -0
  157. package/components/hy-waterfall/hy-waterfall.vue +51 -0
  158. package/components/hy-waterfall/props.ts +10 -0
  159. package/components/hy-waterfall/typing.d.ts +20 -0
  160. package/components/index.ts +162 -0
  161. package/components/message/TheMessage.vue +169 -0
  162. package/components/message/index.ts +54 -0
  163. package/components/u-form/form.js +22 -0
  164. package/components/u-form/hy-form.vue +324 -0
  165. package/components/u-form/props.js +49 -0
  166. package/components/u-form/schema.js +1451 -0
  167. package/components/u-form/u-form.vue +267 -0
  168. package/components/u-form/utils.js +65 -0
  169. package/components/u-form-item/formItem.js +24 -0
  170. package/components/u-form-item/hy-form-item.vue +360 -0
  171. package/components/u-form-item/props.js +57 -0
  172. package/components/u-form-item/u-form-item.vue +294 -0
  173. package/components/yk-dialog/yk-dialog.vue +129 -0
  174. package/components/yk-tabbar/props.ts +49 -0
  175. package/components/yk-tabbar/yk-tabbar.vue +224 -0
  176. package/config/color.ts +6 -0
  177. package/config/icon.ts +366 -0
  178. package/config/index.ts +2 -0
  179. package/global/index.ts +6 -0
  180. package/global/register-properties.ts +37 -0
  181. package/index.ts +8 -0
  182. package/libs/css/common.scss +0 -0
  183. package/libs/css/iconfont.css +379 -0
  184. package/libs/css/iconfont.ttf +0 -0
  185. package/libs/css/mixin.scss +15 -0
  186. package/package.json +42 -0
  187. package/public/icons/error.png +0 -0
  188. package/public/icons/success.png +0 -0
  189. package/public/icons/warning.png +0 -0
  190. package/store/index.ts +1 -0
  191. package/store/userInfo.ts +25 -0
  192. package/theme.scss +94 -0
  193. package/typing/index.ts +7 -0
  194. package/typing/modules/common.d.ts +50 -0
  195. package/typing/modules/dialog.ts +17 -0
  196. package/typing/modules/enum.ts +67 -0
  197. package/typing/modules/form.ts +161 -0
  198. package/typing/modules/http.ts +68 -0
  199. package/typing/modules/icon.d.ts +366 -0
  200. package/typing/modules/img.ts +15 -0
  201. package/typing/modules/rect.ts +10 -0
  202. package/utils/address.json +5890 -0
  203. package/utils/base64.ts +119 -0
  204. package/utils/index.ts +3 -0
  205. package/utils/inside.ts +310 -0
  206. package/utils/utils.ts +446 -0
@@ -0,0 +1,135 @@
1
+ import { DateModeEnum } from "../../typing";
2
+ import { CSSProperties } from "vue";
3
+
4
+ export default interface IProps {
5
+ /**
6
+ * @description 用于控制选择器的弹出和收起 ( 默认 false )
7
+ * */
8
+ show?: boolean;
9
+ /**
10
+ * @description 弹出层弹出方向
11
+ * */
12
+ popupMode?: HyApp.LayoutType;
13
+ /**
14
+ * @description 是否显示顶部的操作栏 ( 默认 true )
15
+ * */
16
+ showToolbar?: boolean;
17
+ /**
18
+ * @description 绑定值
19
+ * @note 类型有问题,需要调整(加了Date类型)
20
+ * */
21
+ modelValue: string | number | Date;
22
+ /**
23
+ * @description 顶部标题
24
+ * */
25
+ title?: string;
26
+ /**
27
+ * @description 展示格式 mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择 ( 默认 ‘datetime )
28
+ * */
29
+ mode?: DateModeEnum;
30
+ /**
31
+ * @description 可选的最大时间 默认值为后10年
32
+ * */
33
+ maxDate?: number;
34
+ /**
35
+ * @description 可选的最小时间 默认值为前10年
36
+ * */
37
+ minDate?: number;
38
+ /**
39
+ * @description 可选的最小小时,仅mode=time有效
40
+ * */
41
+ minHour?: number;
42
+ /**
43
+ * @description 可选的最大小时,仅mode=time有效
44
+ * */
45
+ maxHour?: number;
46
+ /**
47
+ * @description 可选的最小分钟,仅mode=time有效
48
+ * */
49
+ minMinute?: number;
50
+ /**
51
+ * @description 可选的最大分钟,仅mode=time有效
52
+ * */
53
+ maxMinute?: number;
54
+ /**
55
+ * @description 选项过滤函数
56
+ * */
57
+ filter?: null | ((type: string, values: string[]) => string[]);
58
+ /**
59
+ * @description 选项格式化函数
60
+ * */
61
+ formatter?: null | ((type: string, value: string) => string);
62
+ /**
63
+ * @description 是否显示加载中状态 ( 默认 false )
64
+ * */
65
+ loading?: boolean;
66
+ /**
67
+ * @description 各列中,单个选项的高度 ( 默认 44 )
68
+ * */
69
+ itemHeight?: number;
70
+ /**
71
+ * @description 取消按钮的文字 ( 默认 '取消' )
72
+ * */
73
+ cancelText?: string;
74
+ /**
75
+ * @description 确认按钮的文字 ( 默认 '确认' )
76
+ * */
77
+ confirmText?: string;
78
+ /**
79
+ * @description 取消按钮的颜色 ( 默认 '#909193' )
80
+ * */
81
+ cancelColor?: string;
82
+ /**
83
+ * @description 确认按钮的颜色 ( 默认 '#3c9cff' )
84
+ * */
85
+ confirmColor?: string;
86
+ /**
87
+ * @description 每列中可见选项的数量 ( 默认 5 )
88
+ * */
89
+ visibleItemCount?: number;
90
+ /**
91
+ * @description 是否允许点击遮罩关闭选择器 ( 默认 false )
92
+ * */
93
+ closeOnClickOverlay?: boolean;
94
+ /**
95
+ * @description 各列的默认索引
96
+ * @note 类型有问题,需要调整
97
+ * */
98
+ defaultIndex?: Array<any>;
99
+ /**
100
+ * @description 是否禁用输入框 ( 默认 false )
101
+ * */
102
+ disabled?: boolean;
103
+ /**
104
+ * @description 输入框是否显示边框 ( 默认 false )
105
+ * */
106
+ hasInput?: boolean;
107
+ /**
108
+ * @description 自定义时间格式
109
+ * */
110
+ format?: string;
111
+ /**
112
+ * @description 输入框提示信息
113
+ * */
114
+ placeholder?: string;
115
+ /**
116
+ * @description 禁用时候输入框颜色
117
+ * */
118
+ disabledColor?: string;
119
+ /**
120
+ * @description 右边插槽
121
+ * */
122
+ toolbarRightSlot?: boolean;
123
+ /**
124
+ * @description 输入框形状
125
+ * */
126
+ shape?: HyApp.ShapeType;
127
+ /**
128
+ * @description 输入框边框
129
+ * */
130
+ border?: HyApp.BorderType;
131
+ /**
132
+ * @description 自定义输入框外部样式
133
+ * */
134
+ customStyle?: CSSProperties;
135
+ }
@@ -0,0 +1,164 @@
1
+ <template>
2
+ <view class="hy-divider" :style="dividerStyle" @tap="clickHandler">
3
+ <view class="hy-divider__line" :style="[leftLineStyle, lineStyle]"></view>
4
+ <HyIcon
5
+ v-if="text === 'loading'"
6
+ :name="IconConfig.LOADING"
7
+ :color="textColor"
8
+ is-rotate
9
+ ></HyIcon>
10
+ <text v-if="dot" class="hy-divider__dot">●</text>
11
+ <text v-else-if="text" class="hy-divider__text" :style="textStyle">{{
12
+ content
13
+ }}</text>
14
+ <view class="hy-divider__line" :style="[rightLineStyle, lineStyle]"></view>
15
+ </view>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import { computed, CSSProperties, toRefs } from "vue";
20
+ import defaultProps from "./props";
21
+ import IProps from "./typing";
22
+ import { addUnit } from "../../utils";
23
+ import { IconConfig } from "../../config";
24
+
25
+ // 组件
26
+ import HyIcon from "../hy-icon/hy-icon.vue";
27
+
28
+ const props = withDefaults(defineProps<IProps>(), defaultProps);
29
+ const {
30
+ text,
31
+ textSize,
32
+ textColor,
33
+ textPosition,
34
+ dashed,
35
+ lineColor,
36
+ loadMoreText,
37
+ loadingText,
38
+ noMoreText,
39
+ marginTop,
40
+ marginBottom,
41
+ customStyle
42
+ } = toRefs(props);
43
+ const emit = defineEmits(["click"]);
44
+
45
+ const isLoad = ["loadMore", "loading", "noMore"].includes(text.value);
46
+
47
+ /**
48
+ * @description 分割线样式
49
+ * */
50
+ const dividerStyle = computed<CSSProperties>(() => {
51
+ const style: CSSProperties = {};
52
+ style.marginTop =
53
+ addUnit(marginTop.value) || isLoad ? "20px" : addUnit(marginTop.value);
54
+ style.marginBottom =
55
+ addUnit(marginBottom.value) || isLoad
56
+ ? "20px"
57
+ : addUnit(marginBottom.value);
58
+ return Object.assign(style, customStyle.value);
59
+ });
60
+ /**
61
+ * @description 文本内容
62
+ * */
63
+ const content = computed(() => {
64
+ let text = "";
65
+ switch (props.text) {
66
+ case "loadMore":
67
+ text = loadMoreText.value;
68
+ break;
69
+ case "loading":
70
+ text = loadingText.value;
71
+ break;
72
+ case "noMore":
73
+ text = noMoreText.value;
74
+ break;
75
+ default:
76
+ text = props.text;
77
+ break;
78
+ }
79
+ return text;
80
+ });
81
+ /**
82
+ * @description 文本内容样式
83
+ * */
84
+ const textStyle = computed<CSSProperties>(() => {
85
+ const style: CSSProperties = {};
86
+ style.fontSize = addUnit(textSize.value);
87
+ style.color = textColor.value;
88
+ return style;
89
+ });
90
+ /**
91
+ * @description 线样式
92
+ * */
93
+ const lineStyle = computed<CSSProperties>(() => {
94
+ const style: CSSProperties = {
95
+ borderBottom: `1px ${dashed.value ? "dashed" : "solid"} ${lineColor.value}`
96
+ };
97
+ return style;
98
+ });
99
+ /**
100
+ * @description 左边线条的的样式
101
+ * */
102
+ const leftLineStyle = computed<CSSProperties>(() => {
103
+ const style: CSSProperties = {
104
+ marginRight: "20rpx"
105
+ };
106
+ // 如果是在左边,设置左边的宽度为固定值
107
+ if (isLoad) {
108
+ style.width = "80px";
109
+ } else if (textPosition.value === "left") {
110
+ style.width = "80rpx";
111
+ } else {
112
+ style.flex = 1;
113
+ }
114
+ return style;
115
+ });
116
+ /**
117
+ * @description 右边线条的的样式
118
+ * */
119
+ const rightLineStyle = computed<CSSProperties>(() => {
120
+ const style: CSSProperties = {
121
+ marginLeft: "20rpx"
122
+ };
123
+ // 如果是在右边,设置右边的宽度为固定值
124
+ if (isLoad) {
125
+ style.width = "80px";
126
+ } else if (textPosition.value === "right") {
127
+ style.width = "80rpx";
128
+ } else {
129
+ style.flex = 1;
130
+ }
131
+ return style;
132
+ });
133
+ const clickHandler = () => {
134
+ emit("click");
135
+ };
136
+ </script>
137
+
138
+ <style lang="scss" scoped>
139
+ @import "../../libs/css/mixin.scss";
140
+ @import "../../theme.scss";
141
+
142
+ .hy-divider {
143
+ @include flex;
144
+ flex-direction: row;
145
+ justify-content: center;
146
+ align-items: center;
147
+
148
+ &__line {
149
+ /* #ifndef APP-NVUE */
150
+ vertical-align: middle;
151
+ /* #endif */
152
+ }
153
+
154
+ &__text {
155
+ margin: 0 $hy-border-margin-padding-sm;
156
+ }
157
+
158
+ &__dot {
159
+ font-size: $hy-font-size-sm;
160
+ margin: 0 $hy-border-margin-padding-sm;
161
+ color: #c0c4cc;
162
+ }
163
+ }
164
+ </style>
@@ -0,0 +1,21 @@
1
+ import IProps from "./typing";
2
+ import { IconConfig } from "../../config";
3
+
4
+ const defaultProps: IProps = {
5
+ dashed: false,
6
+ hairline: true,
7
+ dot: false,
8
+ textPosition: "center",
9
+ text: "",
10
+ textSize: 14,
11
+ textColor: "#909399",
12
+ lineColor: "#dcdfe6",
13
+ loadingIcon: IconConfig.LOADING,
14
+ loadMoreText: "加载更多",
15
+ loadingText: "正在加载...",
16
+ noMoreText: "没有更多了",
17
+ marginTop: "0",
18
+ marginBottom: "0"
19
+ };
20
+
21
+ export default defaultProps;
@@ -0,0 +1,64 @@
1
+ import { CSSProperties } from "vue";
2
+
3
+ export default interface IProps {
4
+ /**
5
+ * @description 是否虚线 (默认 false )
6
+ * */
7
+ dashed?: boolean;
8
+ /**
9
+ * @description 是否细线 (默认 true )
10
+ * */
11
+ hairline?: boolean;
12
+ /**
13
+ * @description 是否以点替代文字,优先于text字段起作用 (默认 false )
14
+ * */
15
+ dot?: boolean;
16
+ /**
17
+ * @description 内容文本的位置,left-左边,center-中间,right-右边 (默认 'center' )
18
+ * */
19
+ textPosition?: "center" | HyApp.LeftRightType;
20
+ /**
21
+ * @description 文本内容
22
+ * */
23
+ text?: string | "loadMore" | "loading" | "noMore";
24
+ /**
25
+ * @description 文本大小 (默认 14)
26
+ * */
27
+ textSize?: string | number;
28
+ /**
29
+ * @description 文本颜色 (默认 '#909399' )
30
+ * */
31
+ textColor?: string;
32
+ /**
33
+ * @description 线条颜色 (默认 '#dcdfe6' )
34
+ * */
35
+ lineColor?: string;
36
+ /**
37
+ * @description 加载图标(默认 'loading' )
38
+ * */
39
+ loadingIcon?: string;
40
+ /**
41
+ * @description 加载前的提示语(默认 '加载更多' )
42
+ * */
43
+ loadMoreText?: string;
44
+ /**
45
+ * @description 加载中提示语(默认 '正在加载...' )
46
+ * */
47
+ loadingText?: string;
48
+ /**
49
+ * @description 没有更多的提示语(默认 '没有更多了' )
50
+ * */
51
+ noMoreText?: string;
52
+ /**
53
+ * @description 上边距 (默认 0 )
54
+ * */
55
+ marginTop?: string | number;
56
+ /**
57
+ * @description 下边距 (默认 0 )
58
+ * */
59
+ marginBottom?: string | number;
60
+ /**
61
+ * @description 定义需要用到的外部样式
62
+ * */
63
+ customStyle?: CSSProperties;
64
+ }
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <view class="hy-empty" v-if="show" :style="emptyStyle">
3
+ <view class="hy-empty__img" :style="imgStyle">
4
+ <HyIcon
5
+ :name="imageUrl"
6
+ :width="width"
7
+ :height="height"
8
+ img-mode="widthFix"
9
+ ></HyIcon>
10
+ </view>
11
+ <view v-if="$slots.default">
12
+ <slot></slot>
13
+ </view>
14
+ <view class="hy-empty__description" v-else>
15
+ <slot v-if="$slots.description" name="description"></slot>
16
+ <text v-else :style="descriptionStyle">{{ emptyDescription }}</text>
17
+ <HyButton
18
+ class="hy-empty__button"
19
+ v-if="btnText"
20
+ :text="btnText"
21
+ :size="btnSize"
22
+ :type="btnType"
23
+ :shape="btnShape"
24
+ :plain="btnPlain"
25
+ @click="handleClick"
26
+ ></HyButton>
27
+ </view>
28
+ </view>
29
+ </template>
30
+
31
+ <script setup lang="ts">
32
+ import { computed, CSSProperties, toRefs } from "vue";
33
+ import defaultProps from "./props";
34
+ import IProps from "./typing";
35
+ import { addUnit } from "../../utils";
36
+
37
+ // 组件
38
+ import HyButton from "../hy-button/hy-button.vue";
39
+ import HyIcon from "../hy-icon/hy-icon.vue";
40
+
41
+ const props = withDefaults(defineProps<IProps>(), defaultProps);
42
+ const {
43
+ zIndex,
44
+ width,
45
+ height,
46
+ imgMargin,
47
+ navigateUrl,
48
+ desSize,
49
+ desColor,
50
+ customStyle
51
+ } = toRefs(props);
52
+ const emit = defineEmits(["click"]);
53
+
54
+ const emptyDescription = computed(() => {
55
+ return props.description;
56
+ });
57
+
58
+ /**
59
+ * @description 整体样式
60
+ * */
61
+ const emptyStyle = computed<CSSProperties>(() => {
62
+ const style: CSSProperties = {
63
+ zIndex: zIndex.value
64
+ };
65
+ return Object.assign(style, customStyle.value);
66
+ });
67
+
68
+ /**
69
+ * @description 提示信息样式
70
+ * */
71
+ const descriptionStyle = computed<CSSProperties>(() => {
72
+ const style: CSSProperties = {
73
+ fontSize: addUnit(desSize.value),
74
+ color: desColor.value
75
+ };
76
+ return style;
77
+ });
78
+
79
+ /**
80
+ * @description 图片样式
81
+ * */
82
+ const imgStyle = computed<CSSProperties>(() => {
83
+ return {
84
+ width: addUnit(width.value),
85
+ height: addUnit(height.value),
86
+ margin: imgMargin.value
87
+ };
88
+ });
89
+
90
+ /**
91
+ * @description 点击按钮,跳转页面
92
+ * */
93
+ const handleClick = () => {
94
+ emit("click");
95
+ if (navigateUrl.value) {
96
+ uni.navigateTo({
97
+ url: navigateUrl.value
98
+ });
99
+ }
100
+ };
101
+ </script>
102
+ <style scoped lang="scss">
103
+ .hy-empty {
104
+ top: 0;
105
+ left: 0;
106
+ width: 100%;
107
+ height: 100%;
108
+ display: flex;
109
+ justify-content: center;
110
+ align-items: center;
111
+ flex-direction: column;
112
+ background: rgb(255, 255, 255);
113
+ &__description {
114
+ width: 70%;
115
+ text-align: center;
116
+ }
117
+
118
+ &__button {
119
+ margin-top: 80rpx;
120
+ }
121
+ }
122
+ </style>
@@ -0,0 +1,21 @@
1
+ import IProps from "./typing";
2
+
3
+ const defaultProps: IProps = {
4
+ show: true,
5
+ imageUrl: "https://pic.imgdb.cn/item/6737057ad29ded1a8c6f843b.webp",
6
+ zIndex: 889,
7
+ width: 350,
8
+ height: "auto",
9
+ description: "暂无数据",
10
+ desSize: 15,
11
+ desColor: "#5e6d82",
12
+ imgMargin: "",
13
+ btnText: "",
14
+ btnSize: "normal",
15
+ btnType: "primary",
16
+ btnShape: "square",
17
+ btnPlain: false,
18
+ navigateUrl: ""
19
+ };
20
+
21
+ export default defaultProps;
@@ -0,0 +1,68 @@
1
+ import { CSSProperties } from "vue";
2
+
3
+ export default interface IProps {
4
+ /**
5
+ * @description 是否显示空状态
6
+ * */
7
+ show?: boolean;
8
+ /**
9
+ * @description 空状态图片
10
+ * */
11
+ imageUrl?: string;
12
+ /**
13
+ * @description 组件层级
14
+ * */
15
+ zIndex?: number;
16
+ /**
17
+ * @description icon宽度
18
+ * */
19
+ width?: number | string;
20
+ /**
21
+ * @description icon高度
22
+ * */
23
+ height?: number | string;
24
+ /**
25
+ * @description 提示信息
26
+ * */
27
+ description?: string;
28
+ /**
29
+ * @description 提示信息大小
30
+ * */
31
+ desSize?: string | number;
32
+ /**
33
+ * @description 提示信息颜色
34
+ * */
35
+ desColor?: string;
36
+ /**
37
+ * @description 图片margin
38
+ * */
39
+ imgMargin?: string;
40
+ /**
41
+ * @description 按钮文字
42
+ * */
43
+ btnText?: string;
44
+ /**
45
+ * @description 按钮尺寸,large,normal,mini (默认 normal)
46
+ * */
47
+ btnSize?: "normal" | "large" | "small" | "mini";
48
+ /**
49
+ * @description 按钮的预置样式,info,primary,error,warning,success (默认 'info' )
50
+ * */
51
+ btnType?: HyApp.ThemeType;
52
+ /**
53
+ * @description 按钮形状,circle(两边为半圆),square(带圆角) (默认 'square' )
54
+ * */
55
+ btnShape?: HyApp.ShapeType;
56
+ /**
57
+ * @description 按钮是否镂空,背景色透明 (默认 false)
58
+ * */
59
+ btnPlain?: boolean;
60
+ /**
61
+ * @description 跳转地址
62
+ * */
63
+ navigateUrl?: string;
64
+ /**
65
+ * @description 自定义输入框外部样式
66
+ * */
67
+ customStyle?: CSSProperties;
68
+ }
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <view class="hy-folding-panel">
3
+ <HyCell
4
+ :title="title"
5
+ :titleBorder="titleBorder"
6
+ :border="border"
7
+ :showVertical="showVertical"
8
+ :verticalColor="verticalColor"
9
+ :size="size"
10
+ :disabled="disabled"
11
+ :list="lists"
12
+ @click="clickHandler"
13
+ >
14
+ <template #icon="{ icon }">
15
+ <slot name="icon" :icon="icon"></slot>
16
+ </template>
17
+ <template #title="{ title }">
18
+ <slot name="title" :title="title"></slot>
19
+ </template>
20
+ <template #value="{ record }">
21
+ <slot name="value" :record="record"></slot>
22
+ </template>
23
+ <template #bottom="{ record }">
24
+ <view
25
+ class="hy-folding-panel__main"
26
+ :style="[
27
+ customStyle,
28
+ {
29
+ height: record?.spread ? addUnit(contentHeight) : '0px'
30
+ }
31
+ ]"
32
+ >
33
+ <slot :record="record?.content" />
34
+ </view>
35
+ <HyLine v-if="record?.spread"></HyLine>
36
+ </template>
37
+ </HyCell>
38
+ </view>
39
+ </template>
40
+
41
+ <script setup lang="ts">
42
+ import { toRefs, ref, watch } from "vue";
43
+ import defaultProps from "./props";
44
+ import IProps, { PanelVo } from "./typing";
45
+
46
+ import HyCell from "../hy-cell/hy-cell.vue";
47
+ import HyLine from "../hy-line/hy-line.vue";
48
+ import { addUnit } from "../../utils";
49
+
50
+ const props = withDefaults(defineProps<IProps>(), defaultProps);
51
+ const { list, contentHeight, accordion } = toRefs(props);
52
+ const emit = defineEmits(["open", "close", "change"]);
53
+
54
+ const lists = ref<PanelVo[]>([]);
55
+
56
+ watch(
57
+ () => list.value,
58
+ (newValue: PanelVo[]) => {
59
+ lists.value = newValue.map((item) => ({
60
+ ...item,
61
+ arrowDirection: "down",
62
+ spread: false
63
+ }));
64
+ },
65
+ { immediate: true }
66
+ );
67
+
68
+ const clickHandler = (temp: PanelVo, index: number) => {
69
+ // if (temp?.disabled && temp?.animating) return;
70
+ lists.value = list.value.map((item, i) => {
71
+ if (accordion.value) {
72
+ item.spread = i === index;
73
+ } else {
74
+ if (i === index) {
75
+ item.spread = !item.spread;
76
+ }
77
+ }
78
+
79
+ item.arrowDirection = item.spread ? "up" : "down";
80
+ return item;
81
+ });
82
+ emit("change", temp, index);
83
+ emit(temp.spread ? "open" : "close", temp, index);
84
+ };
85
+ </script>
86
+
87
+ <style lang="scss" scoped>
88
+ .hy-folding-panel {
89
+ &__main {
90
+ overflow: auto;
91
+ transition: height 0.5s ease;
92
+ }
93
+ }
94
+ </style>
@@ -0,0 +1,17 @@
1
+ import IProps from "./typing";
2
+ import { ColorConfig } from "../../config";
3
+
4
+ const defaultProps: IProps = {
5
+ list: [],
6
+ accordion: false,
7
+ title: "",
8
+ titleBorder: false,
9
+ border: true,
10
+ verticalColor: ColorConfig.primary,
11
+ showVertical: true,
12
+ disabled: false,
13
+ size: "medium",
14
+ contentHeight: 120
15
+ };
16
+
17
+ export default defaultProps;