hy-app 0.4.4 → 0.4.5

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 (147) hide show
  1. package/components/hy-action-sheet/hy-action-sheet.vue +1 -1
  2. package/components/hy-address-picker/hy-address-picker.vue +1 -1
  3. package/components/hy-avatar/hy-avatar.vue +1 -1
  4. package/components/hy-back-top/hy-back-top.vue +1 -2
  5. package/components/hy-badge/hy-badge.vue +1 -1
  6. package/components/hy-button/hy-button.vue +1 -2
  7. package/components/hy-calendar/hy-calendar.vue +3 -11
  8. package/components/hy-calendar/month.vue +1 -1
  9. package/components/hy-card/hy-card.vue +1 -1
  10. package/components/hy-cell/hy-cell.vue +1 -2
  11. package/components/hy-cell/props.ts +1 -1
  12. package/components/hy-check-button/hy-check-button.vue +2 -2
  13. package/components/hy-checkbox/hy-checkbox.vue +2 -3
  14. package/components/hy-checkbox-group/hy-checkbox-group.vue +1 -1
  15. package/components/hy-checkbox-item/hy-checkbox-item.vue +1 -2
  16. package/components/hy-code-input/hy-code-input.vue +1 -1
  17. package/components/hy-config-provider/hy-config-provider.vue +2 -3
  18. package/components/hy-config-provider/props.ts +1 -1
  19. package/components/hy-count-down/index.ts +1 -1
  20. package/components/hy-count-to/hy-count-to.vue +1 -1
  21. package/components/hy-datetime-picker/hy-datetime-picker.vue +2 -3
  22. package/components/hy-datetime-picker/props.ts +1 -1
  23. package/components/hy-divider/hy-divider.vue +1 -2
  24. package/components/hy-divider/props.ts +1 -1
  25. package/components/hy-dropdown/hy-dropdown.vue +2 -3
  26. package/components/hy-dropdown/props.ts +1 -1
  27. package/components/hy-dropdown-item/hy-dropdown-item.vue +1 -2
  28. package/components/hy-empty/hy-empty.vue +1 -1
  29. package/components/hy-flex/hy-flex.vue +1 -1
  30. package/components/hy-float-button/hy-float-button.vue +1 -2
  31. package/components/hy-float-button/props.ts +14 -14
  32. package/components/hy-folding-panel/hy-folding-panel.vue +2 -3
  33. package/components/hy-folding-panel/props.ts +1 -1
  34. package/components/hy-form/hy-form.vue +1 -1
  35. package/components/hy-form-group/hy-form-group.vue +183 -111
  36. package/components/hy-form-group/typing.d.ts +1 -1
  37. package/components/hy-form-item/hy-form-item.vue +1 -1
  38. package/components/hy-grid/hy-grid.vue +1 -1
  39. package/components/hy-icon/hy-icon.vue +1 -1
  40. package/components/hy-icon/index.scss +1 -1
  41. package/components/hy-image/hy-image.vue +1 -2
  42. package/components/hy-image/props.ts +10 -10
  43. package/components/hy-input/hy-input.vue +1 -2
  44. package/components/hy-line/hy-line.vue +1 -1
  45. package/components/hy-line-progress/hy-line-progress.vue +1 -2
  46. package/components/hy-list/hy-list.vue +1 -1
  47. package/components/hy-loading/hy-loading.vue +1 -1
  48. package/components/hy-menu/hy-menu.vue +1 -1
  49. package/components/hy-modal/hy-modal.vue +2 -2
  50. package/components/hy-modal/props.ts +13 -13
  51. package/components/hy-navbar/hy-navbar.vue +1 -2
  52. package/components/hy-navbar/props.ts +1 -1
  53. package/components/hy-notice-bar/hy-column-notice.vue +1 -2
  54. package/components/hy-notice-bar/hy-notice-bar.vue +1 -1
  55. package/components/hy-notice-bar/hy-row-notice.vue +1 -2
  56. package/components/hy-notice-bar/props.ts +1 -1
  57. package/components/hy-notify/hy-notify.vue +1 -2
  58. package/components/hy-number-step/hy-number-step.vue +1 -2
  59. package/components/hy-overlay/hy-overlay.vue +1 -1
  60. package/components/hy-pagination/hy-pagination.vue +1 -1
  61. package/components/hy-picker/hy-picker.vue +1 -2
  62. package/components/hy-popover/hy-popover.vue +9 -3
  63. package/components/hy-popup/hy-popup.vue +2 -3
  64. package/components/hy-price/hy-price.vue +3 -2
  65. package/components/hy-qrcode/hy-qrcode.vue +1 -1
  66. package/components/hy-radio/hy-radio.vue +1 -2
  67. package/components/hy-rate/hy-rate.vue +6 -4
  68. package/components/hy-rate/props.ts +6 -6
  69. package/components/hy-read-more/hy-read-more.vue +1 -2
  70. package/components/hy-scroll-list/hy-scroll-list.vue +1 -1
  71. package/components/hy-scroll-list/props.ts +0 -1
  72. package/components/hy-search/hy-search.vue +3 -3
  73. package/components/hy-signature/hy-signature.vue +1 -1
  74. package/components/hy-slider/hy-slider.vue +3 -13
  75. package/components/hy-slider/props.ts +1 -1
  76. package/components/hy-status-bar/hy-status-bar.vue +1 -1
  77. package/components/hy-status-bar/props.ts +1 -1
  78. package/components/hy-steps/hy-steps.vue +1 -2
  79. package/components/hy-subsection/hy-subsection.vue +1 -1
  80. package/components/hy-subsection/props.ts +0 -1
  81. package/components/hy-subsection/typing.d.ts +0 -1
  82. package/components/hy-swipe-action/hy-swipe-action.vue +1 -2
  83. package/components/hy-swiper/hy-swiper-indicator.vue +1 -1
  84. package/components/hy-swiper/hy-swiper.vue +2 -3
  85. package/components/hy-swiper/typing.d.ts +35 -36
  86. package/components/hy-switch/hy-switch.vue +2 -2
  87. package/components/hy-switch/typing.d.ts +0 -1
  88. package/components/hy-tabs/hy-tabs.vue +2 -3
  89. package/components/hy-tag/hy-tag.vue +1 -2
  90. package/components/hy-text/hy-text.vue +2 -2
  91. package/components/hy-text/typing.d.ts +26 -26
  92. package/components/hy-textarea/hy-textarea.vue +2 -2
  93. package/components/hy-toast/hy-toast.vue +33 -19
  94. package/components/hy-toast/index.scss +3 -2
  95. package/components/hy-toast/typing.d.ts +1 -1
  96. package/components/hy-tooltip/hy-tooltip.vue +8 -2
  97. package/components/hy-transition/hy-transition.vue +1 -1
  98. package/components/hy-upload/hy-upload.vue +7 -2
  99. package/components/hy-upload/props.ts +1 -1
  100. package/components/hy-warn/hy-warn.vue +1 -2
  101. package/components/hy-warn/typing.d.ts +12 -13
  102. package/components/hy-waterfall/hy-waterfall.vue +1 -1
  103. package/components/hy-watermark/hy-watermark.vue +1 -1
  104. package/components/index.ts +117 -118
  105. package/index.ts +1 -7
  106. package/{api → libs/api}/http.ts +2 -2
  107. package/libs/common/index.ts +2 -0
  108. package/libs/common/queue.ts +28 -0
  109. package/{composables → libs/composables}/index.ts +1 -0
  110. package/{composables → libs/composables}/usePopover.ts +7 -2
  111. package/{common/shakeService.ts → libs/composables/useShakeService.ts} +4 -2
  112. package/{composables → libs/composables}/useShare.ts +3 -0
  113. package/libs/composables/useToast.ts +45 -0
  114. package/{composables → libs/composables}/useTouch.ts +3 -0
  115. package/{global → libs/global}/register-properties.ts +1 -1
  116. package/libs/index.ts +7 -0
  117. package/{typing → libs/typing}/index.ts +0 -1
  118. package/{typing → libs/typing}/modules/form.ts +7 -7
  119. package/{utils → libs/utils}/utils.ts +1 -0
  120. package/package.json +2 -2
  121. package/common/index.ts +0 -3
  122. package/common/queue.ts +0 -34
  123. package/components/hy-form/README.md +0 -301
  124. package/components/hy-text/index.ts +0 -0
  125. package/components/yk-dialog/yk-dialog.vue +0 -129
  126. package/composables/useToast.ts +0 -51
  127. package/typing/modules/dialog.ts +0 -17
  128. /package/{api → libs/api}/index.ts +0 -0
  129. /package/{common → libs/common}/versionControl.ts +0 -0
  130. /package/{composables → libs/composables}/useQueue.ts +0 -0
  131. /package/{config → libs/config}/color.ts +0 -0
  132. /package/{config → libs/config}/icon.ts +0 -0
  133. /package/{config → libs/config}/index.ts +0 -0
  134. /package/{static/font → libs/css}/iconfont.css +0 -0
  135. /package/{global → libs/global}/index.ts +0 -0
  136. /package/{typing → libs/typing}/modules/common.d.ts +0 -0
  137. /package/{typing → libs/typing}/modules/enum.ts +0 -0
  138. /package/{typing → libs/typing}/modules/http.ts +0 -0
  139. /package/{typing → libs/typing}/modules/icon.d.ts +0 -0
  140. /package/{typing → libs/typing}/modules/rect.ts +0 -0
  141. /package/{utils → libs/utils}/address.json +0 -0
  142. /package/{utils → libs/utils}/base64.ts +0 -0
  143. /package/{utils → libs/utils}/calendar.js +0 -0
  144. /package/{utils → libs/utils}/colorGradient.ts +0 -0
  145. /package/{utils → libs/utils}/index.ts +0 -0
  146. /package/{utils → libs/utils}/inside.ts +0 -0
  147. /package/{utils → libs/utils}/inspect.ts +0 -0
@@ -1,128 +1,127 @@
1
- import type { CSSProperties, PropType } from 'vue'
2
- import { HyApp } from '@/package/typing/modules/common'
1
+ import type { CSSProperties } from "vue";
3
2
 
4
3
  export default interface HySwiperProps {
5
4
  /**
6
5
  * @description 轮播图数据
7
6
  * */
8
- list: (string | Record<string, unknown>)[]
7
+ list: (string | Record<string, unknown>)[];
9
8
  /**
10
9
  * @description list数组中指定对象的目标属性名(默认 'url' )
11
10
  * */
12
- keyName?: string
11
+ keyName?: string;
13
12
  /**
14
13
  * @description 是否显示面板指示器(默认 false )
15
14
  * */
16
- indicator?: boolean
15
+ indicator?: boolean;
17
16
  /**
18
17
  * @description 指示器非激活颜色(默认 '#FFFFFF' )
19
18
  * */
20
- indicatorActiveColor?: string
19
+ indicatorActiveColor?: string;
21
20
  /**
22
21
  * @description 指示器的激活颜色(默认 'rgba(255, 255, 255, 0.35)' )
23
22
  * */
24
- indicatorInactiveColor?: string
23
+ indicatorInactiveColor?: string;
25
24
  /**
26
25
  * @description 指示器样式,可通过bottom,left,right进行定位
27
26
  * */
28
- indicatorStyle?: CSSProperties
27
+ indicatorStyle?: CSSProperties;
29
28
  /**
30
29
  * @description 指示器模式(默认 'line' )
31
30
  * */
32
- indicatorMode?: HyApp.SwiperIndicatorModeType
31
+ indicatorMode?: HyApp.SwiperIndicatorModeType;
33
32
  /**
34
33
  * @description 是否自动切换(默认 true )
35
34
  * */
36
- autoplay?: boolean
35
+ autoplay?: boolean;
37
36
  /**
38
37
  * @description 当前所在滑块的 index(默认 0 )
39
38
  * */
40
- current?: number | string
39
+ current?: number | string;
41
40
  /**
42
41
  * @description 当前所在滑块的 item-id ,不能与 current 被同时指定
43
42
  * */
44
- currentItemId?: string
43
+ currentItemId?: string;
45
44
  /**
46
45
  * @description 滑块自动切换时间间隔(ms)(默认 3000 )
47
46
  * */
48
- interval?: number
47
+ interval?: number;
49
48
  /**
50
49
  * @description 滑块切换过程所需时间(ms)(默认 300 )
51
50
  * */
52
- duration?: number
51
+ duration?: number;
53
52
  /**
54
53
  * @description 播放到末尾后是否重新回到开头(默认 false )
55
54
  * */
56
- circular?: boolean
55
+ circular?: boolean;
57
56
  /**
58
57
  * @description 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持(默认 0 )
59
58
  * */
60
- previousMargin?: number | string
59
+ previousMargin?: number | string;
61
60
  /**
62
61
  * @description 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持(默认 0 )
63
62
  * */
64
- nextMargin?: number | string
63
+ nextMargin?: number | string;
65
64
  /**
66
65
  * @description 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持(默认 false )
67
66
  * */
68
- acceleration?: boolean
67
+ acceleration?: boolean;
69
68
  /**
70
69
  * @description 同时显示的滑块数量,nvue、支付宝小程序不支持(默认 1 )
71
70
  * */
72
- displayMultipleItems?: number
71
+ displayMultipleItems?: number;
73
72
  /**
74
73
  * @description 指定swiper切换缓动动画类型, 只对微信小程序有效(默认 'default' )
75
74
  * */
76
- easingFunction?: string
75
+ easingFunction?: string;
77
76
  /**
78
77
  * @description 图片的裁剪模式(默认 'aspectFill' )
79
78
  * */
80
- imgMode?: HyApp.ImageModeVo
79
+ imgMode?: HyApp.ImageModeVo;
81
80
  /**
82
81
  * @description 组件高度(默认 130 )
83
82
  * */
84
- height?: number
83
+ height?: number;
85
84
  /**
86
85
  * @description 背景颜色(默认 '#f3f4f6' )
87
86
  * */
88
- bgColor?: string
87
+ bgColor?: string;
89
88
  /**
90
89
  * @description 组件圆角,数值或带单位的字符串(默认 4 )
91
90
  * */
92
- radius?: number | string
91
+ radius?: number | string;
93
92
  /**
94
93
  * @description 是否加载中(默认 false )
95
94
  * */
96
- loading?: boolean
95
+ loading?: boolean;
97
96
  /**
98
97
  * @description 是否显示标题,要求数组对象中有title属性(默认 false )
99
98
  * */
100
- showTitle?: boolean
99
+ showTitle?: boolean;
101
100
  }
102
101
 
103
102
  export interface SwiperList {
104
- [key: string]: any
103
+ [key: string]: any;
105
104
  /** 线上地址 */
106
- url?: string
105
+ url?: string;
107
106
  /** 标题 */
108
- title?: string
107
+ title?: string;
109
108
  /** 海报,为视频必填 */
110
- poster?: string
109
+ poster?: string;
111
110
  /** 轮播图展示类型 */
112
- type?: 'image' | 'video'
111
+ type?: "image" | "video";
113
112
  }
114
113
 
115
114
  export interface SwiperVo {
116
115
  detail: {
117
- current: number
118
- }
116
+ current: number;
117
+ };
119
118
  }
120
119
 
121
120
  export interface ISwiperEmits {
122
121
  /** 点击轮播图触发 */
123
- (e: 'click', index: number): void
122
+ (e: "click", index: number): void;
124
123
  /** 滑动轮播图触发 */
125
- (e: 'change', temp: SwiperVo['detail']): void
124
+ (e: "change", temp: SwiperVo["detail"]): void;
126
125
  /** 滑动轮播图触发 */
127
- (e: 'update:current', value: string | number): void
126
+ (e: "update:current", value: string | number): void;
128
127
  }
@@ -54,9 +54,9 @@ export default {
54
54
  </script>
55
55
 
56
56
  <script setup lang="ts">
57
- import { toRefs, watch, nextTick, computed } from "vue";
57
+ import { watch, nextTick, computed } from "vue";
58
58
  import type { CSSProperties, PropType } from "vue";
59
- import { addUnit, error, isNumber } from "../../utils";
59
+ import { addUnit, error, isNumber } from "../../libs";
60
60
  import type { ISwitchEmits, SwiperValue } from "./typing";
61
61
  // 组件
62
62
  import HyLoading from "../hy-loading/hy-loading.vue";
@@ -1,5 +1,4 @@
1
1
  import type { CSSProperties } from "vue";
2
- import { HyApp } from "@/package/typing/modules/common";
3
2
  import type IconProps from "../hy-icon/typing";
4
3
 
5
4
  export default interface HySwitchProps {
@@ -158,10 +158,9 @@ import {
158
158
  getCurrentInstance,
159
159
  } from "vue";
160
160
  import type { CSSProperties, PropType } from "vue";
161
- import type { ITabsEmits } from "./typing";
162
- import type { TabsItemVo } from "./typing";
161
+ import type { ITabsEmits, TabsItemVo } from "./typing";
163
162
  import type HyBadgeProps from "../hy-badge/typing";
164
- import { addUnit, getPx, getRect, sleep } from "../../utils";
163
+ import { addUnit, getPx, getRect, sleep } from "../../libs";
165
164
  // 组件
166
165
  import HyBadge from "../hy-badge/hy-badge.vue";
167
166
  import HyIcon from "../hy-icon/hy-icon.vue";
@@ -58,8 +58,7 @@ export default {
58
58
  import { computed } from "vue";
59
59
  import type { CSSProperties, PropType } from "vue";
60
60
  import type { ITagEmits } from "./typing";
61
- import { IconConfig } from "../../config";
62
- import { colorGradient } from "../../utils";
61
+ import { IconConfig, colorGradient } from "../../libs";
63
62
  import type HyIconProps from "../hy-icon/typing";
64
63
 
65
64
  // 组件
@@ -89,11 +89,11 @@ import {
89
89
  formatTime,
90
90
  isDate,
91
91
  priceFormat,
92
- } from "../../utils";
92
+ } from "../../libs";
93
+ import type { InputOnConfirmEvent } from "@uni-helper/uni-types";
93
94
 
94
95
  // 组件
95
96
  import HyIcon from "../hy-icon/hy-icon.vue";
96
- import type { InputOnConfirmEvent } from "@uni-helper/uni-types";
97
97
 
98
98
  /**
99
99
  * 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
@@ -1,103 +1,103 @@
1
- import type { CSSProperties } from 'vue'
1
+ import type { CSSProperties } from "vue";
2
2
 
3
- export type TextMode = 'text' | 'price' | 'phone' | 'name' | 'date' | 'link'
3
+ export type TextMode = "text" | "price" | "phone" | "name" | "date" | "link";
4
4
 
5
5
  export default interface HyTextProps {
6
6
  /**
7
7
  * @description 显示的值
8
8
  * */
9
- text: string | number
9
+ text: string | number;
10
10
  /**
11
11
  * @description 主题颜色
12
12
  * */
13
- type?: HyApp.ThemeType
13
+ type?: HyApp.ThemeType | "";
14
14
  /**
15
15
  * @description 是否显示(默认 true )
16
16
  * */
17
- show?: boolean
17
+ show?: boolean;
18
18
  /**
19
19
  * @description 前置图标
20
20
  * */
21
- prefixIcon?: string
21
+ prefixIcon?: string;
22
22
  /**
23
23
  * @description 后置图标
24
24
  * */
25
- suffixIcon?: string
25
+ suffixIcon?: string;
26
26
  /**
27
27
  * @description 文本处理的匹配模式 text-普通文本,price-价格,phone-手机号,name-姓名,date-日期,link-超链接
28
28
  * */
29
- mode?: TextMode
29
+ mode?: TextMode;
30
30
  /**
31
31
  * @description mode=link下,配置的链接
32
32
  * */
33
- href?: string
33
+ href?: string;
34
34
  /**
35
35
  * @description 格式化规则
36
36
  * */
37
- format?: Function | string
37
+ format?: Function | string;
38
38
  /**
39
39
  * @description mode=phone时,点击文本是否拨打电话(默认 false )
40
40
  * */
41
- call?: boolean
41
+ call?: boolean;
42
42
  /**
43
43
  * @description 小程序的打开方式
44
44
  * */
45
- openType?: string
45
+ openType?: string;
46
46
  /**
47
47
  * @description 是否粗体,默认normal(默认 false )
48
48
  * */
49
- bold?: boolean
49
+ bold?: boolean;
50
50
  /**
51
51
  * @description 是否块状(默认 false )
52
52
  * */
53
- block?: boolean
53
+ block?: boolean;
54
54
  /**
55
55
  * @description 文本显示的行数,如果设置,超出此行数,将会显示省略号
56
56
  * */
57
- lines?: string | number
57
+ lines?: string | number;
58
58
  /**
59
59
  * @description 文本颜色(默认 '#303133' )
60
60
  * */
61
- color?: string
61
+ color?: string;
62
62
  /**
63
63
  * @description 字体大小(默认 15 )
64
64
  * */
65
- size?: number | string
65
+ size?: number | string;
66
66
  /**
67
67
  * @description 图标的样式 (默认 {fontSize: '15px'} )
68
68
  * */
69
- iconStyle?: CSSProperties
69
+ iconStyle?: CSSProperties;
70
70
  /**
71
71
  * @description 文字装饰,下划线,中划线等,可选值 none|underline|line-through(默认 'none' )
72
72
  * */
73
- decoration?: '' | 'none' | 'underline' | 'line-through'
73
+ decoration?: "" | "none" | "underline" | "line-through";
74
74
  /**
75
75
  * @description 外边距,对象、字符串,数值形式均可(默认 0 )
76
76
  * */
77
- margin?: string
77
+ margin?: string;
78
78
  /**
79
79
  * @description 文本行高
80
80
  * */
81
- lineHeight?: string | number
81
+ lineHeight?: string | number;
82
82
  /**
83
83
  * @description 文本对齐方式,可选值left|center|right(默认 'left' )
84
84
  * */
85
- align?: HyApp.RowCenterType
85
+ align?: HyApp.RowCenterType;
86
86
  /**
87
87
  * @description 文字换行,可选值break-word|normal|anywhere(默认 'normal' )
88
88
  * */
89
- wordWrap?: 'normal' | 'break-word' | 'anywhere'
89
+ wordWrap?: "normal" | "break-word" | "anywhere";
90
90
  /**
91
91
  * @description 是否占满剩余空间(默认:true)
92
92
  * */
93
- flex?: boolean
93
+ flex?: boolean;
94
94
  /**
95
95
  * @description 定义需要用到的外部样式
96
96
  * */
97
- customStyle?: CSSProperties
97
+ customStyle?: CSSProperties;
98
98
  }
99
99
 
100
100
  export interface ITextEmits {
101
101
  /** 点击触发 */
102
- (e: 'click', event: any): void
102
+ (e: "click", event: any): void;
103
103
  }
@@ -6,7 +6,7 @@
6
6
  <textarea
7
7
  class="hy-textarea__field"
8
8
  :value="innerValue"
9
- :style="{ height: autoHeight ? 'auto' : addUnit(height) }"
9
+ :style="`height: ${autoHeight ? 'auto' : addUnit(height)}`"
10
10
  :placeholder="placeholder || ''"
11
11
  :placeholder-style="placeholderStyle"
12
12
  :placeholder-class="placeholderClass"
@@ -60,7 +60,7 @@ export default {
60
60
  import { computed, ref, watch, nextTick, inject } from "vue";
61
61
  import type { CSSProperties, PropType } from "vue";
62
62
  import type { ITextareaEmits } from "./typing";
63
- import { addUnit } from "../../utils";
63
+ import { addUnit } from "../../libs";
64
64
  import type { FormItemContext } from "../hy-form-item/typing";
65
65
  import type {
66
66
  InputOnBlurEvent,
@@ -4,16 +4,7 @@
4
4
  :zIndex="tmpConfig.overlay ? 10070 : -1"
5
5
  :custom-style="overlayStyle"
6
6
  >
7
- <view
8
- :style="[contentStyle]"
9
- :class="[
10
- 'hy-toast__content',
11
- 'hy-toast__' + tmpConfig.type,
12
- tmpConfig.type === 'loading' || tmpConfig.loading
13
- ? 'hy-toast__content--loading'
14
- : '',
15
- ]"
16
- >
7
+ <view :style="[contentStyle]" :class="contentClass">
17
8
  <HyLoading
18
9
  v-if="tmpConfig.loading"
19
10
  :mode="tmpConfig.loadMode || 'circle'"
@@ -31,7 +22,12 @@
31
22
  >
32
23
  <HyIcon :name="iconNameCom" size="17" color="#FFFFFF"></HyIcon>
33
24
  </view>
34
- <text class="hy-toast__content--text" style="max-width: 400rpx">
25
+ <text
26
+ :class="[
27
+ 'hy-toast__content--text',
28
+ !tmpConfig.icon ? `hy-toast__content--text__${tmpConfig.type}` : '',
29
+ ]"
30
+ >
35
31
  {{ tmpConfig.message }}
36
32
  </text>
37
33
  </view>
@@ -50,11 +46,10 @@ export default {
50
46
  </script>
51
47
 
52
48
  <script setup lang="ts">
53
- import { computed, reactive, ref } from "vue";
49
+ import { computed, onMounted, onUnmounted, reactive, ref } from "vue";
54
50
  import type { CSSProperties } from "vue";
55
- import type ToastParamsVo from "./typing";
56
- import { getWindowInfo, hexToRgb } from "../../utils";
57
- import { ColorConfig, iconName } from "../../config";
51
+ import type ToastOptions from "./typing";
52
+ import { ColorConfig, iconName, getWindowInfo, hexToRgb } from "../../libs";
58
53
  // 组件
59
54
  import HyOverlay from "../hy-overlay/hy-overlay.vue";
60
55
  import HyIcon from "../hy-icon/hy-icon.vue";
@@ -67,10 +62,10 @@ import HyLoading from "../hy-loading/hy-loading.vue";
67
62
  defineOptions({});
68
63
 
69
64
  const isShow = ref(false);
70
- const tmpConfig = ref<ToastParamsVo>({});
71
- const config: ToastParamsVo = reactive({
65
+ const tmpConfig = ref<ToastOptions>({});
66
+ const config: ToastOptions = reactive({
72
67
  message: "",
73
- type: "info",
68
+ type: "",
74
69
  duration: 2000,
75
70
  icon: false,
76
71
  position: "center",
@@ -127,6 +122,14 @@ const contentStyle = computed(() => {
127
122
  return style;
128
123
  });
129
124
 
125
+ const contentClass = computed(() => {
126
+ return [
127
+ "hy-toast__content",
128
+ "hy-toast__" + tmpConfig.value.type,
129
+ tmpConfig.value.loading && "hy-toast__content--loading",
130
+ ];
131
+ });
132
+
130
133
  const loadingIconColor = computed(() => {
131
134
  let colorTmp = "rgb(255, 255, 255)";
132
135
  if (isThemeType(tmpConfig.value.type!)) {
@@ -137,10 +140,21 @@ const loadingIconColor = computed(() => {
137
140
  return colorTmp;
138
141
  });
139
142
 
143
+ onMounted(() => {
144
+ // 监听全局事件
145
+ uni.$on("__hy_toast_open__", show);
146
+ uni.$on("__hy_toast_close__", hide);
147
+ });
148
+
149
+ onUnmounted(() => {
150
+ uni.$off("__hy_toast_open__", show);
151
+ uni.$off("__hy_toast_close__", hide);
152
+ });
153
+
140
154
  /**
141
155
  * @description 显示toast组件,由父组件通过xxx.show(options)形式调用
142
156
  * */
143
- const show = (options: ToastParamsVo) => {
157
+ const show = (options: ToastOptions) => {
144
158
  // 不将结果合并到this.config变量,避免多次调用u-toast,前后的配置造成混乱
145
159
  tmpConfig.value = Object.assign(config, options);
146
160
  // 清除定时器
@@ -59,9 +59,10 @@
59
59
  color: #ffffff;
60
60
  font-size: 15px;
61
61
  line-height: 15px;
62
+ max-width: 400rpx;
62
63
 
63
- @include e(default) {
64
- color: #ffffff;
64
+ @include e(info) {
65
+ color: $hy-info;
65
66
  }
66
67
 
67
68
  @include e(error) {
@@ -6,7 +6,7 @@ export default interface ToastOptions {
6
6
  /**
7
7
  * @description 主题类型,primary,success,error,warning,info
8
8
  * */
9
- type?: HyApp.ThemeType;
9
+ type?: HyApp.ThemeType | "";
10
10
  /**
11
11
  * @description toast出现的位置
12
12
  * */
@@ -146,9 +146,15 @@ import {
146
146
  } from "vue";
147
147
  import type { CSSProperties, PropType } from "vue";
148
148
  import type { ITooltipEmits } from "./typing";
149
- import { type Queue, queueKey, usePopover } from "../../composables";
150
149
  import type { IPlacementVo } from "../hy-popover/typing";
151
- import { closeOther, removeFromQueue, pushToQueue } from "../../common";
150
+ import {
151
+ type Queue,
152
+ queueKey,
153
+ usePopover,
154
+ closeOther,
155
+ removeFromQueue,
156
+ pushToQueue,
157
+ } from "../../libs";
152
158
 
153
159
  // 组件
154
160
  import HyTransition from "../hy-transition/hy-transition.vue";
@@ -25,7 +25,7 @@ export default {
25
25
  <script setup lang="ts">
26
26
  import { computed, ref, watch, nextTick } from "vue";
27
27
  import type { CSSProperties, PropType } from "vue";
28
- import { sleep } from "../../utils";
28
+ import { sleep } from "../../libs";
29
29
  import type { ITransitionEmits } from "./typing";
30
30
 
31
31
  /**
@@ -145,8 +145,13 @@ export default {
145
145
  import { ref, watch } from "vue";
146
146
  import type { PropType, CSSProperties } from "vue";
147
147
  import type { FileVo, IUploadEmits, ReadFunctionVo } from "./typing";
148
- import { addUnit, bytesToSize, chooseFile, isArray } from "../../utils";
149
- import { IconConfig } from "../../config";
148
+ import {
149
+ addUnit,
150
+ bytesToSize,
151
+ chooseFile,
152
+ isArray,
153
+ IconConfig,
154
+ } from "../../libs";
150
155
  // 组件
151
156
  import HyIcon from "../hy-icon/hy-icon.vue";
152
157
 
@@ -1,5 +1,5 @@
1
1
  import type IProps from "./typing";
2
- import { IconConfig } from "../../config";
2
+ import { IconConfig } from "../../libs";
3
3
 
4
4
  const defaultProps: IProps = {
5
5
  accept: "image",
@@ -76,8 +76,7 @@ export default {
76
76
  import { computed, ref } from "vue";
77
77
  import type { CSSProperties, PropType } from "vue";
78
78
  import type { IWarnEmits } from "./typing";
79
- import { addUnit } from "../../utils";
80
- import { IconConfig, iconName } from "../../config";
79
+ import { addUnit, IconConfig, iconName } from "../../libs";
81
80
  // 组件
82
81
  import HyTransition from "../hy-transition/hy-transition.vue";
83
82
  import HyIcon from "../hy-icon/hy-icon.vue";
@@ -1,48 +1,47 @@
1
- import type { CSSProperties } from 'vue'
2
- import { HyApp, type ThemeVo } from '@/package/typing/modules/common'
1
+ import type { CSSProperties } from "vue";
3
2
 
4
3
  export default interface HyWarnProps {
5
4
  /**
6
5
  * @description 显示的文字
7
6
  * */
8
- title: string
7
+ title: string;
9
8
  /**
10
9
  * @description 使用预设的颜色 (默认 'warning' )
11
10
  * */
12
- type?: HyApp.ThemeType
11
+ type?: HyApp.ThemeType;
13
12
  /**
14
13
  * @description 辅助性文字,颜色比title浅一点,字号也小一点,可选
15
14
  * */
16
- description?: string
15
+ description?: string;
17
16
  /**
18
17
  * @description 关闭按钮(默认为叉号icon图标) (默认 false )
19
18
  * */
20
- closable?: boolean
19
+ closable?: boolean;
21
20
  /**
22
21
  * @description 是否显示左边的辅助图标 ( 默认 false )
23
22
  * */
24
- showIcon?: boolean
23
+ showIcon?: boolean;
25
24
  /**
26
25
  * @description 显示的暗色或者亮色 (默认 'light' )
27
26
  * */
28
- theme?: HyApp.ThemeVo
27
+ theme?: HyApp.ThemeVo;
29
28
  /**
30
29
  * @description 文字是否居中 (默认 false )
31
30
  * */
32
- center?: boolean
31
+ center?: boolean;
33
32
  /**
34
33
  * @description 字体大小 (默认 14 )
35
34
  * */
36
- fontSize?: number
35
+ fontSize?: number;
37
36
  /**
38
37
  * @description 定义需要用到的外部样式
39
38
  * */
40
- customStyle?: CSSProperties
39
+ customStyle?: CSSProperties;
41
40
  }
42
41
 
43
42
  export interface IWarnEmits {
44
43
  /** 点击触发 */
45
- (e: 'click'): void
44
+ (e: "click"): void;
46
45
  /** 关闭触发 */
47
- (e: 'close'): void
46
+ (e: "close"): void;
48
47
  }
@@ -31,7 +31,7 @@ export default {
31
31
  <script setup lang="ts">
32
32
  import { computed, getCurrentInstance, ref, watch } from "vue";
33
33
  import type { PropType } from "vue";
34
- import { getRect, isArray } from "../../utils";
34
+ import { getRect, isArray } from "../../libs";
35
35
 
36
36
  /**
37
37
  * 这是一个瀑布流形式的组件,内容分为左右两列,结合uview的懒加载组件效果更佳。
@@ -28,7 +28,7 @@ export default {
28
28
  <script lang="ts" setup>
29
29
  import { computed, onMounted, ref, watch, nextTick } from "vue";
30
30
  import type { CSSProperties } from "vue";
31
- import { addUnit, guid } from "../../utils";
31
+ import { addUnit, guid } from "../../libs";
32
32
 
33
33
  /**
34
34
  * 在页面或组件上添加指定的图片或文字,可用于版权保护、品牌宣传等场景。