hy-app 0.2.13 → 0.2.15

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 (223) hide show
  1. package/components/hy-action-sheet/hy-action-sheet.vue +81 -13
  2. package/components/hy-action-sheet/typing.d.ts +1 -3
  3. package/components/hy-address-picker/hy-address-picker.vue +109 -8
  4. package/components/hy-address-picker/index.scss +2 -2
  5. package/components/hy-address-picker/typing.d.ts +39 -30
  6. package/components/hy-avatar/hy-avatar.vue +78 -4
  7. package/components/hy-avatar/typing.d.ts +21 -16
  8. package/components/hy-back-top/hy-back-top.vue +86 -28
  9. package/components/hy-back-top/typing.d.ts +17 -12
  10. package/components/hy-badge/hy-badge.vue +114 -43
  11. package/components/hy-badge/typing.d.ts +20 -15
  12. package/components/hy-button/HyButton.docgen.js +6 -0
  13. package/components/hy-button/hy-button.vue +70 -77
  14. package/components/hy-button/props.ts +40 -41
  15. package/components/hy-calendar/hy-calendar.vue +290 -143
  16. package/components/hy-calendar/typing.d.ts +38 -31
  17. package/components/hy-card/hy-card.vue +139 -36
  18. package/components/hy-card/typing.d.ts +39 -28
  19. package/components/hy-cell/hy-cell.vue +131 -67
  20. package/components/hy-cell/typing.d.ts +6 -1
  21. package/components/hy-check-button/hy-check-button.vue +101 -32
  22. package/components/hy-check-button/typing.d.ts +26 -19
  23. package/components/hy-checkbox/hy-checkbox.vue +167 -78
  24. package/components/hy-checkbox/typing.d.ts +26 -19
  25. package/components/hy-code-input/hy-code-input.vue +101 -5
  26. package/components/hy-code-input/typing.d.ts +9 -0
  27. package/components/hy-config-provider/hy-config-provider.vue +44 -24
  28. package/components/hy-config-provider/typing.d.ts +0 -4
  29. package/components/hy-count-down/hy-count-down.vue +99 -62
  30. package/components/hy-count-down/typing.d.ts +18 -5
  31. package/components/hy-count-to/hy-count-to.vue +165 -113
  32. package/components/hy-count-to/typing.d.ts +15 -11
  33. package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
  34. package/components/hy-datetime-picker/typing.d.ts +49 -39
  35. package/components/hy-divider/hy-divider.vue +128 -64
  36. package/components/hy-divider/typing.d.ts +16 -16
  37. package/components/hy-dropdown/hy-dropdown.vue +57 -19
  38. package/components/hy-dropdown/typing.d.ts +14 -14
  39. package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
  40. package/components/hy-dropdown-item/typing.d.ts +13 -6
  41. package/components/hy-empty/hy-empty.vue +64 -6
  42. package/components/hy-empty/typing.d.ts +5 -0
  43. package/components/hy-float-button/hy-float-button.vue +117 -5
  44. package/components/hy-float-button/typing.d.ts +7 -0
  45. package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
  46. package/components/hy-folding-panel/typing.d.ts +24 -15
  47. package/components/hy-grid/hy-grid.vue +95 -35
  48. package/components/hy-grid/typing.d.ts +24 -19
  49. package/components/hy-icon/hy-icon.vue +84 -6
  50. package/components/hy-icon/typing.d.ts +5 -0
  51. package/components/hy-image/hy-image.vue +105 -6
  52. package/components/hy-image/typing.d.ts +9 -0
  53. package/components/hy-input/hy-input.vue +277 -130
  54. package/components/hy-input/props.ts +13 -14
  55. package/components/hy-input/typing.d.ts +59 -38
  56. package/components/hy-line/hy-line.vue +65 -25
  57. package/components/hy-line-progress/hy-line-progress.vue +68 -35
  58. package/components/hy-list/hy-list.vue +127 -61
  59. package/components/hy-list/typing.d.ts +19 -12
  60. package/components/hy-loading/hy-loading.vue +79 -25
  61. package/components/hy-menu/hy-menu.vue +69 -45
  62. package/components/hy-menu/typing.d.ts +22 -15
  63. package/components/hy-modal/hy-modal.vue +91 -4
  64. package/components/hy-modal/typing.d.ts +11 -0
  65. package/components/hy-navbar/hy-navbar.vue +105 -25
  66. package/components/hy-navbar/typing.d.ts +25 -20
  67. package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
  68. package/components/hy-notice-bar/typing.d.ts +22 -17
  69. package/components/hy-notify/hy-notify.vue +106 -54
  70. package/components/hy-number-step/hy-number-step.vue +211 -120
  71. package/components/hy-number-step/typing.d.ts +45 -28
  72. package/components/hy-overlay/hy-overlay.vue +60 -16
  73. package/components/hy-overlay/typing.d.ts +11 -6
  74. package/components/hy-pagination/hy-pagination.vue +94 -37
  75. package/components/hy-pagination/typing.d.ts +20 -11
  76. package/components/hy-picker/hy-picker.vue +225 -160
  77. package/components/hy-picker/typing.d.ts +51 -28
  78. package/components/hy-popover/hy-popover.vue +55 -7
  79. package/components/hy-popover/typing.d.ts +21 -1
  80. package/components/hy-popup/hy-popup.vue +164 -99
  81. package/components/hy-popup/typing.d.ts +11 -0
  82. package/components/hy-price/hy-price.vue +77 -30
  83. package/components/hy-price/typing.d.ts +10 -10
  84. package/components/hy-qrcode/hy-qrcode.vue +75 -5
  85. package/components/hy-qrcode/typing.d.ts +25 -16
  86. package/components/hy-radio/hy-radio.vue +169 -88
  87. package/components/hy-radio/typing.d.ts +29 -22
  88. package/components/hy-rate/hy-rate.vue +155 -104
  89. package/components/hy-rate/typing.d.ts +23 -16
  90. package/components/hy-read-more/hy-read-more.vue +83 -56
  91. package/components/hy-read-more/typing.d.ts +18 -11
  92. package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
  93. package/components/hy-scroll-list/typing.d.ts +14 -7
  94. package/components/hy-search/hy-search.vue +168 -62
  95. package/components/hy-search/typing.d.ts +47 -26
  96. package/components/hy-signature/hy-signature.vue +354 -272
  97. package/components/hy-signature/typing.d.ts +65 -52
  98. package/components/hy-slider/hy-slider.vue +208 -160
  99. package/components/hy-slider/typing.d.ts +28 -17
  100. package/components/hy-steps/hy-steps.vue +125 -99
  101. package/components/hy-steps/typing.d.ts +21 -14
  102. package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
  103. package/components/hy-submit-bar/typing.d.ts +30 -23
  104. package/components/hy-subsection/hy-subsection.vue +139 -96
  105. package/components/hy-subsection/typing.d.ts +23 -16
  106. package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
  107. package/components/hy-swipe-action/typing.d.ts +26 -17
  108. package/components/hy-swiper/hy-swiper.vue +178 -73
  109. package/components/hy-swiper/typing.d.ts +37 -28
  110. package/components/hy-switch/hy-switch.vue +107 -60
  111. package/components/hy-switch/typing.d.ts +25 -18
  112. package/components/hy-tabs/hy-tabs.vue +170 -160
  113. package/components/hy-tabs/typing.d.ts +36 -22
  114. package/components/hy-tag/hy-tag.vue +133 -58
  115. package/components/hy-tag/typing.d.ts +26 -18
  116. package/components/hy-text/hy-text.vue +106 -6
  117. package/components/hy-text/typing.d.ts +31 -26
  118. package/components/hy-textarea/hy-textarea.vue +183 -89
  119. package/components/hy-textarea/typing.d.ts +41 -24
  120. package/components/hy-tooltip/hy-tooltip.vue +145 -101
  121. package/components/hy-tooltip/typing.d.ts +18 -13
  122. package/components/hy-transition/hy-transition.vue +48 -13
  123. package/components/hy-transition/typing.d.ts +17 -0
  124. package/components/hy-upload/hy-upload.vue +113 -148
  125. package/components/hy-upload/typing.d.ts +71 -71
  126. package/components/hy-warn/hy-warn.vue +79 -36
  127. package/components/hy-warn/typing.d.ts +18 -11
  128. package/components/hy-waterfall/hy-waterfall.vue +90 -77
  129. package/components/hy-watermark/hy-watermark.vue +82 -5
  130. package/components/hy-watermark/typing.d.ts +20 -20
  131. package/global.d.ts +39 -59
  132. package/package.json +5 -13
  133. package/utils/inspect.ts +3 -1
  134. package/web-types.json +1 -1
  135. package/component-helper.ts +0 -177
  136. package/components.json +0 -3287
  137. package/dist/attributes.json +0 -1
  138. package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
  139. package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
  140. package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
  141. package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
  142. package/dist/docs/components/hy-badge/hy-badge.md +0 -13
  143. package/dist/docs/components/hy-button/hy-button.md +0 -61
  144. package/dist/docs/components/hy-calendar/header.md +0 -17
  145. package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
  146. package/dist/docs/components/hy-calendar/month.md +0 -38
  147. package/dist/docs/components/hy-card/hy-card.md +0 -24
  148. package/dist/docs/components/hy-cell/hy-cell.md +0 -26
  149. package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
  150. package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
  151. package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
  152. package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
  153. package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
  154. package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
  155. package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
  156. package/dist/docs/components/hy-divider/hy-divider.md +0 -13
  157. package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
  158. package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
  159. package/dist/docs/components/hy-empty/hy-empty.md +0 -20
  160. package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
  161. package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
  162. package/dist/docs/components/hy-form/hy-form.md +0 -29
  163. package/dist/docs/components/hy-grid/hy-grid.md +0 -19
  164. package/dist/docs/components/hy-icon/hy-icon.md +0 -13
  165. package/dist/docs/components/hy-image/hy-image.md +0 -22
  166. package/dist/docs/components/hy-input/hy-input.md +0 -29
  167. package/dist/docs/components/hy-line/hy-line.md +0 -7
  168. package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
  169. package/dist/docs/components/hy-list/hy-list.md +0 -25
  170. package/dist/docs/components/hy-loading/hy-loading.md +0 -14
  171. package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
  172. package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
  173. package/dist/docs/components/hy-login/hy-login.md +0 -14
  174. package/dist/docs/components/hy-menu/hy-menu.md +0 -21
  175. package/dist/docs/components/hy-modal/hy-modal.md +0 -23
  176. package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
  177. package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
  178. package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
  179. package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
  180. package/dist/docs/components/hy-notify/hy-notify.md +0 -23
  181. package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
  182. package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
  183. package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
  184. package/dist/docs/components/hy-parse/hy-parse.md +0 -46
  185. package/dist/docs/components/hy-parse/node/node.md +0 -7
  186. package/dist/docs/components/hy-picker/hy-picker.md +0 -32
  187. package/dist/docs/components/hy-popover/hy-popover.md +0 -34
  188. package/dist/docs/components/hy-popup/hy-popup.md +0 -22
  189. package/dist/docs/components/hy-price/hy-price.md +0 -13
  190. package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
  191. package/dist/docs/components/hy-radio/hy-radio.md +0 -21
  192. package/dist/docs/components/hy-rate/hy-rate.md +0 -14
  193. package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
  194. package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
  195. package/dist/docs/components/hy-search/hy-search.md +0 -27
  196. package/dist/docs/components/hy-signature/hy-signature.md +0 -45
  197. package/dist/docs/components/hy-slider/hy-slider.md +0 -24
  198. package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
  199. package/dist/docs/components/hy-steps/hy-steps.md +0 -23
  200. package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
  201. package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
  202. package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
  203. package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
  204. package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
  205. package/dist/docs/components/hy-switch/hy-switch.md +0 -20
  206. package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
  207. package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
  208. package/dist/docs/components/hy-tag/hy-tag.md +0 -21
  209. package/dist/docs/components/hy-text/hy-text.md +0 -13
  210. package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
  211. package/dist/docs/components/hy-toast/hy-toast.md +0 -17
  212. package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
  213. package/dist/docs/components/hy-transition/hy-transition.md +0 -25
  214. package/dist/docs/components/hy-upload/hy-upload.md +0 -25
  215. package/dist/docs/components/hy-warn/hy-warn.md +0 -14
  216. package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
  217. package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
  218. package/dist/docs/components/message/TheMessage.md +0 -17
  219. package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
  220. package/dist/tags.json +0 -1
  221. package/dist/web-types.json +0 -1
  222. package/docgen.config.js +0 -14
  223. package/web-types.config.js +0 -7
@@ -1,11 +1,7 @@
1
1
  <template>
2
2
  <view class="hy-menu" :style="{ width: addUnit(width) }">
3
3
  <template v-for="(item, i) in list">
4
- <view
5
- @click="handleClick(item, i)"
6
- :class="menuItemClass(item, i)"
7
- :style="customStyle"
8
- >
4
+ <view @click="handleClick(item, i)" :class="menuItemClass(item, i)" :style="customStyle">
9
5
  <slot name="icon">
10
6
  <hy-icon
11
7
  class="hy-menu-item__icon"
@@ -40,67 +36,95 @@
40
36
  :max="badge?.max"
41
37
  :show-zero="badge?.showZero"
42
38
  :custom-style="badge?.customStyle"
43
- >
44
- </hy-badge>
39
+ ></hy-badge>
45
40
  </view>
46
41
  </template>
47
42
  </view>
48
43
  </template>
49
44
 
50
45
  <script lang="ts">
46
+ /**
47
+ * 垂直展示的导航栏,用于在不同的内容区域之间进行切换。
48
+ * @displayName hy-menu
49
+ */
50
+ defineOptions({})
51
51
  export default {
52
- name: "hy-menu",
52
+ name: 'hy-menu',
53
53
  options: {
54
54
  addGlobalClass: true,
55
55
  virtualHost: true,
56
- styleIsolation: "shared",
56
+ styleIsolation: 'shared',
57
57
  },
58
- };
58
+ }
59
59
  </script>
60
60
 
61
61
  <script lang="ts" setup>
62
- import { computed, ref, toRefs, watch } from "vue";
63
- import type IProps from "./typing";
64
- import type { MenusType } from "./typing";
65
- import defaultProps from "./props";
66
- import { addUnit } from "../../utils";
62
+ import { computed, PropType, ref, toRefs, watch } from 'vue'
63
+ import type { IMenuEmits, MenusType } from './typing'
64
+ import { addUnit } from '../../utils'
65
+
66
+ import type HyBadgeProps from '../hy-badge/typing'
67
+ import type HyIconProps from '../hy-icon/typing'
67
68
 
68
69
  // 组件
69
- import HyIcon from "../hy-icon/hy-icon.vue";
70
- import HyBadge from "../hy-badge/hy-badge.vue";
70
+ import HyIcon from '../hy-icon/hy-icon.vue'
71
+ import HyBadge from '../hy-badge/hy-badge.vue'
71
72
 
72
- const props = withDefaults(defineProps<IProps>(), defaultProps);
73
- const { modelValue, list, color } = toRefs(props);
74
- const emit = defineEmits(["change", "update:modelValue"]);
73
+ // const props = withDefaults(defineProps<IProps>(), defaultProps);
74
+ const props = defineProps({
75
+ /** 当前值 */
76
+ modelValue: String,
77
+ /** 菜单数据集 */
78
+ list: {
79
+ type: Array as PropType<Array<MenusType>>,
80
+ default: [],
81
+ },
82
+ /** 侧边菜单栏宽度 */
83
+ width: {
84
+ type: [String, Number],
85
+ default: 120,
86
+ },
87
+ /** 选中颜色 */
88
+ color: String,
89
+ /** 图标属性值 */
90
+ icon: {
91
+ type: Object as PropType<HyIconProps>,
92
+ default: {},
93
+ },
94
+ /** 徽标属性值 */
95
+ badge: {
96
+ type: Object as PropType<HyBadgeProps>,
97
+ default: {},
98
+ },
99
+ })
100
+ const { modelValue, list, color } = toRefs(props)
101
+ const emit = defineEmits<IMenuEmits>()
75
102
 
76
- const current = ref<string | number>(0);
103
+ const current = ref<string | number>(0)
77
104
 
78
105
  watch(
79
106
  () => modelValue.value,
80
107
  (newVal: string | number) => {
81
- current.value = list.value.findIndex((item) => item.id === newVal);
108
+ current.value = list.value.findIndex((item) => item.id === newVal)
82
109
  // current.value = newVal;
83
110
  },
84
- );
111
+ )
85
112
 
86
113
  const menuItemClass = computed(() => {
87
114
  return (temp: MenusType, i: number) => {
88
115
  const classes = [
89
- "hy-menu-item",
90
- prefix.value && "hy-menu-item--prefix",
91
- suffix.value && "hy-menu-item--suffix",
92
- temp.disabled && "hy-menu-item--disabled",
93
- ];
116
+ 'hy-menu-item',
117
+ prefix.value && 'hy-menu-item--prefix',
118
+ suffix.value && 'hy-menu-item--suffix',
119
+ temp.disabled && 'hy-menu-item--disabled',
120
+ ]
94
121
  if (current.value === i) {
95
- classes.push(
96
- "hy-menu-item--active",
97
- color.value && "hy-menu-item--active__color",
98
- );
122
+ classes.push('hy-menu-item--active', color.value && 'hy-menu-item--active__color')
99
123
  }
100
124
 
101
- return classes;
102
- };
103
- });
125
+ return classes
126
+ }
127
+ })
104
128
 
105
129
  const prefix = computed(() => {
106
130
  // let prefix: boolean = false;
@@ -117,11 +141,11 @@ const prefix = computed(() => {
117
141
  // prefix = true;
118
142
  // }
119
143
  // }
120
- return prefix;
121
- });
144
+ return prefix
145
+ })
122
146
 
123
147
  const suffix = computed(() => {
124
- let suffix: boolean = false;
148
+ let suffix: boolean = false
125
149
  // if (sidebar) {
126
150
  // let activeIndex: number = sidebar.children.findIndex((c: any) => {
127
151
  // return c.value === sidebar.props.modelValue;
@@ -135,21 +159,21 @@ const suffix = computed(() => {
135
159
  // suffix = true;
136
160
  // }
137
161
  // }
138
- return suffix;
139
- });
162
+ return suffix
163
+ })
140
164
 
141
165
  function handleClick(temp: MenusType, i: number) {
142
166
  if (temp?.disabled) {
143
- return;
167
+ return
144
168
  }
145
- current.value = i;
146
- emit("update:modelValue", temp.id);
147
- emit("change", temp);
169
+ current.value = i
170
+ emit('update:modelValue', temp.id)
171
+ emit('change', temp)
148
172
  }
149
173
  </script>
150
174
 
151
175
  <style lang="scss" scoped>
152
- @import "./index.scss";
176
+ @import './index.scss';
153
177
  .hy-menu-item--active__color {
154
178
  color: v-bind(color);
155
179
  &::before {
@@ -1,57 +1,64 @@
1
- import type { CSSProperties } from "vue";
2
- import type HyBadgeProps from "../hy-badge/typing";
3
- import type HyIconProps from "../hy-icon/typing";
1
+ import type { CSSProperties } from 'vue'
2
+ import type HyBadgeProps from '../hy-badge/typing'
3
+ import type HyIconProps from '../hy-icon/typing'
4
4
 
5
5
  export interface MenusType {
6
6
  /**
7
7
  * @description 唯一id
8
8
  * */
9
- id: string | number;
9
+ id: string | number
10
10
  /**
11
11
  * @description 标题
12
12
  * */
13
- title: string;
13
+ title: string
14
14
  /**
15
15
  * @description 是否禁用
16
16
  * */
17
- disabled?: boolean;
17
+ disabled?: boolean
18
18
  /**
19
19
  * @description icon
20
20
  * */
21
- icon?: string;
21
+ icon?: string
22
22
  /**
23
23
  * @description 徽标值
24
24
  * */
25
- badge?: number;
25
+ badge?: number
26
26
  }
27
27
 
28
28
  export default interface HyMenuProps {
29
29
  /**
30
30
  * @description 当前值
31
31
  * */
32
- modelValue: string | number;
32
+ modelValue: string | number
33
33
  /**
34
34
  * @description 菜单数据集
35
35
  * */
36
- list: MenusType[];
36
+ list: MenusType[]
37
37
  /**
38
38
  * @description 侧边菜单栏宽度
39
39
  * */
40
- width?: string | number;
40
+ width?: string | number
41
41
  /**
42
42
  * @description 选中颜色
43
43
  * */
44
- color?: string;
44
+ color?: string
45
45
  /**
46
46
  * @description 图标属性值
47
47
  * */
48
- icon?: Partial<HyIconProps>;
48
+ icon?: Partial<HyIconProps>
49
49
  /**
50
50
  * @description 徽标属性值
51
51
  * */
52
- badge?: Partial<HyBadgeProps>;
52
+ badge?: Partial<HyBadgeProps>
53
53
  /**
54
54
  * @description 定义需要用到的外部样式
55
55
  * */
56
- customStyle?: CSSProperties;
56
+ customStyle?: CSSProperties
57
+ }
58
+
59
+ export interface IMenuEmits {
60
+ /** 选中触发 */
61
+ (e: 'change', temp: MenusType): void
62
+ /** 选中触发 */
63
+ (e: 'update:modelValue', id: MenusType['id']): void
57
64
  }
@@ -88,6 +88,11 @@
88
88
  </template>
89
89
 
90
90
  <script lang="ts">
91
+ /**
92
+ * 弹出模态框,常用于消息提示、消息确认、在当前页面内完成特定的交互操作。
93
+ * @displayName hy-modal
94
+ */
95
+ defineOptions({})
91
96
  export default {
92
97
  name: 'hy-modal',
93
98
  options: {
@@ -100,17 +105,99 @@ export default {
100
105
 
101
106
  <script setup lang="ts">
102
107
  import { ref, toRefs, watch } from 'vue'
103
- import defaultProps from './props'
104
- import type IProps from './typing'
108
+ import type { IModalEmits } from './typing'
105
109
  import { addUnit } from '../../utils'
106
110
 
107
111
  // 组件
108
112
  import HyPopup from '../hy-popup/hy-popup.vue'
109
113
  import HyLoading from '../hy-loading/hy-loading.vue'
110
114
 
111
- const props = withDefaults(defineProps<IProps>(), defaultProps)
115
+ // const props = withDefaults(defineProps<IProps>(), defaultProps)
116
+ const props = defineProps({
117
+ /** 是否显示模态框 */
118
+ modelValue: {
119
+ type: Boolean,
120
+ default: false,
121
+ },
122
+ /** 标题内容 */
123
+ title: String,
124
+ /** 模态框内容,如传入slot内容,则此参数无效 */
125
+ content: String,
126
+ /** 确认按钮的文字 */
127
+ confirmText: {
128
+ type: String,
129
+ default: '确认',
130
+ },
131
+ /** 取消按钮的文字 */
132
+ cancelText: {
133
+ type: String,
134
+ default: '取消',
135
+ },
136
+ /** 是否显示确认按钮 */
137
+ showConfirmButton: {
138
+ type: Boolean,
139
+ default: true,
140
+ },
141
+ /** 是否显示取消按钮 */
142
+ showCancelButton: {
143
+ type: Boolean,
144
+ default: false,
145
+ },
146
+ /** 确认按钮的颜色 */
147
+ confirmColor: String,
148
+ /** 取消按钮的颜色 */
149
+ cancelColor: String,
150
+ /** 对调确认和取消的位置 */
151
+ buttonReverse: {
152
+ type: Boolean,
153
+ default: false,
154
+ },
155
+ /** 是否开启缩放模式 */
156
+ zoom: {
157
+ type: Boolean,
158
+ default: true,
159
+ },
160
+ /** 弹窗的圆角 */
161
+ round: {
162
+ type: [String, Number],
163
+ default: 16,
164
+ },
165
+ /** 是否异步关闭,只对确定按钮有效,见上方说明 */
166
+ asyncClose: {
167
+ type: Boolean,
168
+ default: false,
169
+ },
170
+ /** 是否允许点击遮罩关闭Modal */
171
+ closeOnClickOverlay: {
172
+ type: Boolean,
173
+ default: false,
174
+ },
175
+ /** 往上偏移的值,给一个负的margin-top,往上偏移,避免和键盘重合的情况,单位任意,数值则默认为px单位 */
176
+ negativeTop: {
177
+ type: Number,
178
+ default: 0,
179
+ },
180
+ /** modal宽度,不支持百分比,可以数值,px,rpx单位 */
181
+ width: {
182
+ type: [String, Number],
183
+ default: '550rpx',
184
+ },
185
+ /**
186
+ * 确认按钮的样式,如设置,将不会显示取消按钮
187
+ * @values circle,square
188
+ * */
189
+ confirmButtonShape: String,
190
+ /**
191
+ * 文案对齐方式
192
+ * @values left,center,right
193
+ * */
194
+ contentTextAlign: {
195
+ type: String,
196
+ default: 'left',
197
+ },
198
+ })
112
199
  const { modelValue, asyncClose, closeOnClickOverlay } = toRefs(props)
113
- const emit = defineEmits(['confirm', 'cancel', 'close', 'update:modelValue'])
200
+ const emit = defineEmits<IModalEmits>()
114
201
 
115
202
  const loading = ref<boolean>(false)
116
203
 
@@ -74,3 +74,14 @@ export default interface HyModalProps {
74
74
  * */
75
75
  contentTextAlign?: HyApp.RowCenterType
76
76
  }
77
+
78
+ export interface IModalEmits {
79
+ /** 点击确认按钮时触发 */
80
+ (e: 'confirm'): void
81
+ /** 点击取消按钮时触发 */
82
+ (e: 'cancel'): void
83
+ /** 点击遮罩关闭时触发 */
84
+ (e: 'close'): void
85
+ /** 更新值触发 */
86
+ (e: 'update:modelValue', show: boolean): void
87
+ }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="hy-navbar" :style="customStyle">
2
+ <view :class="['hy-navbar', customClass]" :style="customStyle">
3
3
  <view
4
4
  class="hy-navbar__placeholder"
5
5
  v-if="fixed && placeholder"
@@ -35,8 +35,9 @@
35
35
  color: leftIconColor,
36
36
  }"
37
37
  class="hy-navbar__content__left__text"
38
- >{{ leftText }}</text
39
38
  >
39
+ {{ leftText }}
40
+ </text>
40
41
  </slot>
41
42
  </view>
42
43
  <slot name="center">
@@ -50,8 +51,9 @@
50
51
  },
51
52
  titleStyle,
52
53
  ]"
53
- >{{ title }}</text
54
54
  >
55
+ {{ title }}
56
+ </text>
55
57
  <text
56
58
  class="hy-navbar__content__center--sub"
57
59
  :style="[
@@ -61,8 +63,9 @@
61
63
  },
62
64
  titleStyle,
63
65
  ]"
64
- >{{ sub }}</text
65
66
  >
67
+ {{ sub }}
68
+ </text>
66
69
  </view>
67
70
  </slot>
68
71
  <view
@@ -72,9 +75,7 @@
72
75
  >
73
76
  <slot name="right">
74
77
  <HyIcon v-if="rightIcon" :name="rightIcon" size="20"></HyIcon>
75
- <text v-if="rightText" class="hy-navbar__content__right__text">{{
76
- rightText
77
- }}</text>
78
+ <text v-if="rightText" class="hy-navbar__content__right__text">{{ rightText }}</text>
78
79
  </slot>
79
80
  </view>
80
81
  </view>
@@ -83,51 +84,130 @@
83
84
  </template>
84
85
 
85
86
  <script lang="ts">
87
+ /**
88
+ * 一般用于在特殊情况下,需要自定义导航栏的时候用到,一般建议使用uni-app带的导航栏。
89
+ * @displayName hy-navbar
90
+ */
91
+ defineOptions({})
86
92
  export default {
87
93
  name: 'hy-navbar',
88
94
  options: {
89
95
  addGlobalClass: true,
90
96
  virtualHost: true,
91
- styleIsolation: 'shared'
92
- }
97
+ styleIsolation: 'shared',
98
+ },
93
99
  }
94
100
  </script>
95
101
 
96
102
  <script setup lang="ts">
97
- import defaultProps from "./props";
98
- import type IProps from "./typing";
99
- import { addUnit, getPx, getWindowInfo } from "../../utils";
103
+ import { toRefs } from 'vue'
104
+ import type { CSSProperties, PropType } from 'vue'
105
+ import type { INavbarEmits } from './typing'
106
+ import { addUnit, getPx, getWindowInfo } from '../../utils'
107
+ import { IconConfig } from '../../config'
100
108
 
101
109
  // 组件
102
- import HyIcon from "../hy-icon/hy-icon.vue";
103
- import HyStatusBar from "../hy-status-bar/hy-status-bar.vue";
104
- import { toRefs } from "vue";
110
+ import HyIcon from '../hy-icon/hy-icon.vue'
111
+ import HyStatusBar from '../hy-status-bar/hy-status-bar.vue'
105
112
 
106
- const props = withDefaults(defineProps<IProps>(), defaultProps);
107
- const { autoBack, fixed } = toRefs(props);
108
- const emit = defineEmits(["leftClick", "rightClick"]);
113
+ // const props = withDefaults(defineProps<IProps>(), defaultProps)
114
+ const props = defineProps({
115
+ /** 是否开启顶部安全区适配 */
116
+ safeAreaInsetTop: {
117
+ type: Boolean,
118
+ default: true,
119
+ },
120
+ /** 固定在顶部时,是否生成一个等高元素,以防止塌陷 */
121
+ placeholder: {
122
+ type: Boolean,
123
+ default: false,
124
+ },
125
+ /** 导航栏是否固定在顶部 */
126
+ fixed: {
127
+ type: Boolean,
128
+ default: true,
129
+ },
130
+ /** 导航栏底部是否显示下边框 */
131
+ border: {
132
+ type: Boolean,
133
+ default: false,
134
+ },
135
+ /** 左边返回图标的名称,只能为uview-pls自带的图标 */
136
+ leftIcon: {
137
+ type: String,
138
+ default: IconConfig.LEFT,
139
+ },
140
+ /** 左边的提示文字 */
141
+ leftText: String,
142
+ /** 右边的提示文字 */
143
+ rightText: String,
144
+ /** 右边返回图标的名称,只能为uview-plus自带的图标 */
145
+ rightIcon: String,
146
+ /** 导航栏标题,如设置为空字符,将会隐藏标题占位区域 */
147
+ title: String,
148
+ /** 导航栏副标题 */
149
+ sub: String,
150
+ /** 文字颜色 */
151
+ titleColor: String,
152
+ /** 导航栏背景设置 */
153
+ bgColor: String,
154
+ /** 导航栏标题的最大宽度,内容超出会以省略号隐藏 */
155
+ titleWidth: {
156
+ type: [String, Number],
157
+ default: '400rpx',
158
+ },
159
+ /** 导航栏高度(不包括状态栏高度在内,内部自动加上) */
160
+ height: {
161
+ type: [String, Number],
162
+ default: '44px',
163
+ },
164
+ /** 左侧返回图标的大小 */
165
+ leftIconSize: {
166
+ type: [String, Number],
167
+ default: 20,
168
+ },
169
+ /** 左侧返回图标的颜色 */
170
+ leftIconColor: String,
171
+ /** 点击左侧区域(返回图标),是否自动返回上一页(默认 false ) */
172
+ autoBack: {
173
+ type: Boolean,
174
+ default: false,
175
+ },
176
+ /** 标题的样式,对象或字符串 */
177
+ titleStyle: {
178
+ type: Object as PropType<CSSProperties>,
179
+ },
180
+ /** 定义需要用到的外部样式 */
181
+ customStyle: {
182
+ type: Object as PropType<CSSProperties>,
183
+ },
184
+ /** 自定义外部类名 */
185
+ customClass: String,
186
+ })
187
+ const { autoBack, fixed } = toRefs(props)
188
+ const emit = defineEmits<INavbarEmits>()
109
189
 
110
190
  // 获取状态栏高度
111
- const { statusBarHeight } = getWindowInfo();
191
+ const { statusBarHeight } = getWindowInfo()
112
192
 
113
193
  /**
114
194
  * @description 点击左侧区域
115
195
  * */
116
196
  const leftClick = () => {
117
197
  // 如果配置了autoBack,自动返回上一页
118
- emit("leftClick");
198
+ emit('leftClick')
119
199
  if (autoBack.value) {
120
- uni.navigateBack();
200
+ uni.navigateBack()
121
201
  }
122
- };
202
+ }
123
203
  /**
124
204
  * @description 点击右侧区域
125
205
  * */
126
206
  const rightClick = () => {
127
- emit("rightClick");
128
- };
207
+ emit('rightClick')
208
+ }
129
209
  </script>
130
210
 
131
211
  <style lang="scss" scoped>
132
- @import "./index.scss";
212
+ @import './index.scss';
133
213
  </style>
@@ -1,80 +1,85 @@
1
- import type { CSSProperties } from "vue";
1
+ import type { CSSProperties } from 'vue'
2
2
 
3
3
  export default interface HyNavbarProps {
4
4
  /**
5
5
  * @description 是否开启顶部安全区适配 (默认 true )
6
6
  * */
7
- safeAreaInsetTop?: boolean;
7
+ safeAreaInsetTop?: boolean
8
8
  /**
9
9
  * @description 固定在顶部时,是否生成一个等高元素,以防止塌陷 (默认 false )
10
10
  * */
11
- placeholder?: boolean;
11
+ placeholder?: boolean
12
12
  /**
13
13
  * @description 导航栏是否固定在顶部 (默认 true )
14
14
  * */
15
- fixed?: boolean;
15
+ fixed?: boolean
16
16
  /**
17
17
  * @description 导航栏底部是否显示下边框 (默认 false )
18
18
  * */
19
- border?: boolean;
19
+ border?: boolean
20
20
  /**
21
21
  * @description 左边返回图标的名称,只能为uview-pls自带的图标 (默认 'left' )
22
22
  * */
23
- leftIcon?: string;
23
+ leftIcon?: string
24
24
  /**
25
25
  * @description 左边的提示文字
26
26
  * */
27
- leftText?: string;
27
+ leftText?: string
28
28
  /**
29
29
  * @description 右边的提示文字
30
30
  * */
31
- rightText?: string;
31
+ rightText?: string
32
32
  /**
33
33
  * @description 右边返回图标的名称,只能为uview-plus自带的图标
34
34
  * */
35
- rightIcon?: string;
35
+ rightIcon?: string
36
36
  /**
37
37
  * @description 导航栏标题,如设置为空字符,将会隐藏标题占位区域
38
38
  * */
39
- title?: string;
39
+ title?: string
40
40
  /**
41
41
  * @description 导航栏副标题
42
42
  * */
43
- sub?: string;
43
+ sub?: string
44
44
  /**
45
45
  * @description 文字颜色 (默认 '' )
46
46
  * */
47
- titleColor?: string;
47
+ titleColor?: string
48
48
  /**
49
49
  * @description 导航栏背景设置 (默认 '#ffffff' )
50
50
  * */
51
- bgColor?: string;
51
+ bgColor?: string
52
52
  /**
53
53
  * @description 导航栏标题的最大宽度,内容超出会以省略号隐藏 (默认 '400rpx' )
54
54
  * */
55
- titleWidth?: string | number;
55
+ titleWidth?: string | number
56
56
  /**
57
57
  * @description 导航栏高度(不包括状态栏高度在内,内部自动加上)(默认 '44px' )
58
58
  * */
59
- height?: string | number;
59
+ height?: string | number
60
60
  /**
61
61
  * @description 左侧返回图标的大小(默认 20px )
62
62
  * */
63
- leftIconSize?: string | number;
63
+ leftIconSize?: string | number
64
64
  /**
65
65
  * @description 左侧返回图标的颜色(默认 #303133 )
66
66
  * */
67
- leftIconColor?: string;
67
+ leftIconColor?: string
68
68
  /**
69
69
  * @description 点击左侧区域(返回图标),是否自动返回上一页(默认 false )
70
70
  * */
71
- autoBack?: boolean;
71
+ autoBack?: boolean
72
72
  /**
73
73
  * @description 标题的样式,对象或字符串
74
74
  * */
75
- titleStyle?: CSSProperties;
75
+ titleStyle?: CSSProperties
76
76
  /**
77
77
  * @description 定义需要用到的外部样式
78
78
  * */
79
- customStyle?: CSSProperties;
79
+ customStyle?: CSSProperties
80
+ }
81
+
82
+ export interface INavbarEmits {
83
+ (e: 'leftClick'): void
84
+ (e: 'rightClick'): void
80
85
  }