hy-app 0.2.16 → 0.3.0

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 (100) hide show
  1. package/components/hy-action-sheet/hy-action-sheet.vue +5 -5
  2. package/components/hy-action-sheet/index.scss +6 -1
  3. package/components/hy-address-picker/hy-address-picker.vue +5 -5
  4. package/components/hy-avatar/hy-avatar.vue +5 -5
  5. package/components/hy-back-top/hy-back-top.vue +5 -5
  6. package/components/hy-badge/hy-badge.vue +5 -5
  7. package/components/hy-button/hy-button.vue +5 -5
  8. package/components/hy-calendar/hy-calendar.vue +22 -18
  9. package/components/hy-calendar/typing.d.ts +1 -1
  10. package/components/hy-card/hy-card.vue +5 -5
  11. package/components/hy-cell/hy-cell.vue +10 -11
  12. package/components/hy-check-button/hy-check-button.vue +7 -6
  13. package/components/hy-checkbox/hy-checkbox.vue +14 -14
  14. package/components/hy-code-input/hy-code-input.vue +8 -15
  15. package/components/hy-code-input/index.scss +1 -1
  16. package/components/hy-config-provider/hy-config-provider.vue +8 -6
  17. package/components/hy-count-down/hy-count-down.vue +7 -6
  18. package/components/hy-count-to/hy-count-to.vue +6 -5
  19. package/components/hy-datetime-picker/hy-datetime-picker.vue +7 -7
  20. package/components/hy-divider/hy-divider.vue +10 -7
  21. package/components/hy-dropdown/hy-dropdown.vue +6 -5
  22. package/components/hy-dropdown-item/hy-dropdown-item.vue +7 -5
  23. package/components/hy-empty/hy-empty.vue +6 -5
  24. package/components/hy-float-button/hy-float-button.vue +6 -6
  25. package/components/hy-folding-panel/hy-folding-panel.vue +6 -5
  26. package/components/hy-form/README.md +301 -0
  27. package/components/hy-form/hy-form.vue +252 -533
  28. package/components/hy-form/index.ts +5 -0
  29. package/components/hy-form/typing.d.ts +57 -77
  30. package/components/hy-form-group/hy-form-group.vue +533 -0
  31. package/components/hy-form-group/typing.d.ts +77 -0
  32. package/components/hy-form-item/hy-form-item.vue +199 -0
  33. package/components/hy-form-item/index.scss +41 -0
  34. package/components/hy-form-item/typing.d.ts +43 -0
  35. package/components/hy-grid/hy-grid.vue +11 -13
  36. package/components/hy-grid/typing.d.ts +1 -1
  37. package/components/hy-icon/hy-icon.vue +15 -15
  38. package/components/hy-image/hy-image.vue +15 -9
  39. package/components/hy-input/hy-input.vue +17 -11
  40. package/components/hy-line/hy-line.vue +8 -6
  41. package/components/hy-line-progress/hy-line-progress.vue +9 -16
  42. package/components/hy-list/hy-list.vue +6 -5
  43. package/components/hy-loading/hy-loading.vue +9 -10
  44. package/components/hy-login/TheUserLogin.vue +82 -90
  45. package/components/hy-menu/hy-menu.vue +11 -8
  46. package/components/hy-modal/hy-modal.vue +6 -6
  47. package/components/hy-modal/index.scss +1 -1
  48. package/components/hy-navbar/hy-navbar.vue +6 -6
  49. package/components/hy-notice-bar/hy-notice-bar.vue +14 -9
  50. package/components/hy-notify/hy-notify.vue +6 -6
  51. package/components/hy-number-step/hy-number-step.vue +8 -6
  52. package/components/hy-overlay/hy-overlay.vue +8 -9
  53. package/components/hy-pagination/hy-pagination.vue +11 -8
  54. package/components/hy-picker/hy-picker.vue +9 -9
  55. package/components/hy-popover/hy-popover.vue +11 -7
  56. package/components/hy-popup/hy-popup.vue +9 -7
  57. package/components/hy-price/hy-price.vue +6 -5
  58. package/components/hy-qrcode/hy-qrcode.vue +6 -8
  59. package/components/hy-radio/hy-radio.vue +10 -12
  60. package/components/hy-rate/hy-rate.vue +7 -7
  61. package/components/hy-read-more/hy-read-more.vue +6 -5
  62. package/components/hy-scroll-list/hy-scroll-list.vue +6 -5
  63. package/components/hy-search/hy-search.vue +8 -6
  64. package/components/hy-signature/hy-signature.vue +6 -5
  65. package/components/hy-slider/hy-slider.vue +8 -7
  66. package/components/hy-steps/hy-steps.vue +10 -17
  67. package/components/hy-submit-bar/hy-submit-bar.vue +6 -6
  68. package/components/hy-subsection/hy-subsection.vue +16 -19
  69. package/components/hy-swipe-action/hy-swipe-action.vue +31 -25
  70. package/components/hy-swipe-action/typing.d.ts +1 -1
  71. package/components/hy-swiper/hy-swiper.vue +15 -15
  72. package/components/hy-swiper/typing.d.ts +13 -1
  73. package/components/hy-switch/hy-switch.vue +17 -10
  74. package/components/hy-tabBar/hy-tabBar.vue +35 -26
  75. package/components/hy-tabs/hy-tabs.vue +28 -21
  76. package/components/hy-tag/hy-tag.vue +13 -17
  77. package/components/hy-tag/typing.d.ts +1 -1
  78. package/components/hy-text/hy-text.vue +12 -14
  79. package/components/hy-textarea/hy-textarea.vue +16 -13
  80. package/components/hy-textarea/index.scss +7 -2
  81. package/components/hy-textarea/typing.d.ts +1 -1
  82. package/components/hy-toast/hy-toast.vue +72 -75
  83. package/components/hy-tooltip/hy-tooltip.vue +8 -14
  84. package/components/hy-transition/hy-transition.vue +8 -6
  85. package/components/hy-upload/hy-upload.vue +6 -5
  86. package/components/hy-warn/hy-warn.vue +6 -6
  87. package/components/hy-waterfall/hy-waterfall.vue +8 -7
  88. package/components/hy-watermark/hy-watermark.vue +20 -10
  89. package/components/index.ts +7 -1
  90. package/global.d.ts +3 -1
  91. package/libs/css/common.scss +5 -0
  92. package/libs/css/mixin.scss +2 -1
  93. package/libs/css/vars.css +1 -1
  94. package/package.json +2 -2
  95. package/theme.scss +1 -1
  96. package/utils/inspect.ts +34 -34
  97. package/utils/utils.ts +1 -19
  98. package/web-types.json +1 -1
  99. /package/components/{hy-form → hy-form-group}/index.scss +0 -0
  100. /package/components/{hy-form → hy-form-group}/props.ts +0 -0
@@ -28,8 +28,8 @@
28
28
  <view v-if="!slots.left" class="hy-swipe-action--right__action">
29
29
  <view
30
30
  class="hy-swipe-action--right__action-btn"
31
- :style="item.style"
32
31
  v-for="(item, i) in options"
32
+ :style="item.style"
33
33
  @tap.stop="onActiveClick(item, i)"
34
34
  >
35
35
  {{ item.text }}
@@ -43,11 +43,6 @@
43
43
  </template>
44
44
 
45
45
  <script lang="ts">
46
- /**
47
- * 常用于单元格左右滑删除等手势操作。
48
- * @displayName hy-swipe-action
49
- */
50
- defineOptions({})
51
46
  export default {
52
47
  name: 'hy-swipe-action',
53
48
  options: {
@@ -66,21 +61,32 @@ import {
66
61
  ref,
67
62
  watch,
68
63
  useSlots,
69
- PropType,
64
+ type PropType,
70
65
  } from 'vue'
71
- import type { ISwipeActionEmits } from './typing'
72
- import type { SwipeActionStatus, SwipeActionPosition, SwipeActionReason } from './typing'
66
+ import type {
67
+ ISwipeActionEmits,
68
+ SwipeActionStatus,
69
+ SwipeActionPosition,
70
+ SwipeActionReason,
71
+ SwipeActionOptionsVo,
72
+ } from './typing'
73
73
  import { useTouch } from '../../composables'
74
74
  import { closeOther, pushToQueue, removeFromQueue } from './index'
75
75
  import { getRect, guid } from '../../utils'
76
76
 
77
+ /**
78
+ * 常用于单元格左右滑删除等手势操作。
79
+ * @displayName hy-swipe-action
80
+ */
81
+ defineOptions({})
82
+
77
83
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
78
84
  const props = defineProps({
79
85
  /**
80
86
  * 滑动按钮的状态,使用v-model进行双向绑定。
81
87
  * @values left,close,right
82
88
  * */
83
- modelValue: String,
89
+ modelValue: String as PropType<SwipeActionStatus>,
84
90
  /** 是否禁用滑动操作 */
85
91
  disabled: {
86
92
  type: Boolean,
@@ -93,29 +99,29 @@ const props = defineProps({
93
99
  },
94
100
  /** 右侧按钮内容 */
95
101
  options: {
96
- type: Array as unknown as PropType<SwipeActionStatus>,
97
- default() {
98
- return [
99
- {
100
- text: '收藏',
101
- style: {
102
- backgroundColor: '#3c9cff',
103
- },
102
+ type: Array as unknown as PropType<SwipeActionOptionsVo[]>,
103
+ default: () => [
104
+ {
105
+ text: '收藏',
106
+ style: {
107
+ backgroundColor: '#3c9cff',
104
108
  },
105
- {
106
- text: '删除',
107
- style: {
108
- backgroundColor: '#f56c6c',
109
- },
109
+ },
110
+ {
111
+ text: '删除',
112
+ style: {
113
+ backgroundColor: '#f56c6c',
110
114
  },
111
- ]
112
- },
115
+ },
116
+ ],
113
117
  },
114
118
  /** 动画过渡时间,单位ms */
115
119
  duration: {
116
120
  type: Number,
117
121
  default: 300,
118
122
  },
123
+ /** 关闭滑动按钮前的钩子函数 */
124
+ beforeClose: Function,
119
125
  })
120
126
  const emit = defineEmits<ISwipeActionEmits>()
121
127
  const leftClass = `hy-swipe-action--left--${guid()}`
@@ -1,6 +1,6 @@
1
1
  import type { CSSProperties, PropType } from 'vue'
2
2
 
3
- interface SwipeActionOptionsVo {
3
+ export interface SwipeActionOptionsVo {
4
4
  text: string
5
5
  style?: CSSProperties
6
6
  icon?: string
@@ -85,11 +85,6 @@
85
85
  </template>
86
86
 
87
87
  <script lang="ts">
88
- /**
89
- * 一般用于导航轮播,广告展示等场景,可开箱即用
90
- * @displayName hy-swiper
91
- */
92
- defineOptions({})
93
88
  export default {
94
89
  name: 'hy-swiper',
95
90
  options: {
@@ -101,23 +96,28 @@ export default {
101
96
  </script>
102
97
 
103
98
  <script setup lang="ts">
104
- import { computed, toRefs, ref, watch, getCurrentInstance, type CSSProperties, PropType } from 'vue'
99
+ import { computed, toRefs, ref, watch, getCurrentInstance } from 'vue'
100
+ import type { CSSProperties, PropType } from 'vue'
105
101
  import { addUnit, isVideo } from '../../utils'
106
102
  import { IconConfig } from '../../config'
107
- import type { ISwiperEmits, SwiperVo } from './typing'
103
+ import type { ISwiperEmits, SwiperList, SwiperVo } from './typing'
108
104
 
109
105
  // 组件
110
106
  import HyIcon from '../hy-icon/hy-icon.vue'
111
107
  import HySwiperIndicator from './hy-swiper-indicator.vue'
112
108
 
109
+ /**
110
+ * 一般用于导航轮播,广告展示等场景,可开箱即用
111
+ * @displayName hy-swiper
112
+ */
113
+ defineOptions({})
114
+
113
115
  // const props = withDefaults(defineProps<IProps>(), defaultProps);
114
116
  const props = defineProps({
115
117
  /** 轮播图数据 */
116
118
  list: {
117
- type: Array as unknown as PropType<(string | Record<string, any>)[]>,
118
- default() {
119
- return []
120
- },
119
+ type: Array as PropType<string[] | SwiperList[]>,
120
+ default: () => [],
121
121
  },
122
122
  /** list数组中指定对象的目标属性名 */
123
123
  keyName: {
@@ -175,12 +175,12 @@ const props = defineProps({
175
175
  },
176
176
  /** 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持 */
177
177
  previousMargin: {
178
- type: Number,
178
+ type: [String, Number],
179
179
  default: 0,
180
180
  },
181
181
  /** 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持 */
182
182
  nextMargin: {
183
- type: Number,
183
+ type: [String, Number],
184
184
  default: 0,
185
185
  },
186
186
  /** 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持 */
@@ -215,7 +215,7 @@ const props = defineProps({
215
215
  },
216
216
  /** 组件圆角,数值或带单位的字符串 */
217
217
  radius: {
218
- type: Number,
218
+ type: [String, Number],
219
219
  default: 4,
220
220
  },
221
221
  /** 轮播图是否加载中数据 */
@@ -306,7 +306,7 @@ const pauseVideo = (index: number | string) => {
306
306
  /**
307
307
  * @description 当一个轮播item为视频时,获取它的视频海报
308
308
  * */
309
- const getPoster = (item: string | Record<string, unknown>): string => {
309
+ const getPoster = (item: string | SwiperList): string => {
310
310
  return typeof item === 'object' && item.poster ? item.poster : ''
311
311
  }
312
312
 
@@ -100,6 +100,18 @@ export default interface HySwiperProps {
100
100
  showTitle?: boolean
101
101
  }
102
102
 
103
+ export interface SwiperList {
104
+ [key: string]: any
105
+ /** 线上地址 */
106
+ url?: string
107
+ /** 标题 */
108
+ title?: string
109
+ /** 海报,为视频必填 */
110
+ poster?: string
111
+ /** 轮播图展示类型 */
112
+ type?: 'image' | 'video'
113
+ }
114
+
103
115
  export interface SwiperVo {
104
116
  detail: {
105
117
  current: number
@@ -108,7 +120,7 @@ export interface SwiperVo {
108
120
 
109
121
  export interface ISwiperEmits {
110
122
  /** 点击轮播图触发 */
111
- (e: 'click'): void
123
+ (e: 'click', index: number): void
112
124
  /** 滑动轮播图触发 */
113
125
  (e: 'change', temp: SwiperVo['detail']): void
114
126
  /** 滑动轮播图触发 */
@@ -1,9 +1,10 @@
1
1
  <template>
2
2
  <view
3
- class="hy-switch cursor-pointer"
4
3
  :class="[
4
+ 'hy-switch cursor-pointer',
5
5
  disabled && 'hy-switch--disabled',
6
6
  isActive ? 'hy-switch--active' : 'hy-switch--container',
7
+ customClass,
7
8
  ]"
8
9
  :style="[switchStyle, customStyle]"
9
10
  @tap="clickHandler"
@@ -38,11 +39,6 @@
38
39
  </template>
39
40
 
40
41
  <script lang="ts">
41
- /**
42
- * 选择开关用于在打开和关闭状态之间进行切换。
43
- * @displayName hy-switch
44
- */
45
- defineOptions({})
46
42
  export default {
47
43
  name: 'hy-switch',
48
44
  options: {
@@ -54,7 +50,8 @@ export default {
54
50
  </script>
55
51
 
56
52
  <script setup lang="ts">
57
- import { toRefs, watch, nextTick, computed, type CSSProperties, PropType } from 'vue'
53
+ import { toRefs, watch, nextTick, computed } from 'vue'
54
+ import type { CSSProperties, PropType } from 'vue'
58
55
  import { addUnit, error } from '../../utils'
59
56
  import type { ISwitchEmits } from './typing'
60
57
 
@@ -63,11 +60,17 @@ import HyLoading from '../hy-loading/hy-loading.vue'
63
60
  import HyIcon from '../hy-icon/hy-icon.vue'
64
61
  import HyIconProps from '../hy-icon/typing'
65
62
 
63
+ /**
64
+ * 选择开关用于在打开和关闭状态之间进行切换。
65
+ * @displayName hy-switch
66
+ */
67
+ defineOptions({})
68
+
66
69
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
67
70
  const props = defineProps({
68
71
  /** 通过v-model双向绑定的值 */
69
72
  modelValue: {
70
- type: Boolean,
73
+ type: [String, Number, Boolean],
71
74
  default: false,
72
75
  },
73
76
  /** 是否处于加载中 */
@@ -91,12 +94,12 @@ const props = defineProps({
91
94
  inactiveColor: String,
92
95
  /** 打开选择器时通过change事件发出的值 */
93
96
  activeValue: {
94
- type: Boolean,
97
+ type: [String, Number, Boolean],
95
98
  default: true,
96
99
  },
97
100
  /** 关闭选择器时通过change事件发出的值 */
98
101
  inactiveValue: {
99
- type: Boolean,
102
+ type: [String, Number, Boolean],
100
103
  default: false,
101
104
  },
102
105
  /** 打开选择器时图标 */
@@ -115,6 +118,10 @@ const props = defineProps({
115
118
  type: Number,
116
119
  default: 0,
117
120
  },
121
+ /** 定义需要用到的外部样式 */
122
+ customStyle: Object as PropType<CSSProperties>,
123
+ /** 自定义外部类名 */
124
+ customClass: String,
118
125
  })
119
126
  const {
120
127
  modelValue,
@@ -4,11 +4,7 @@
4
4
  <view class="hy-tabBar--box" :style="{ backgroundColor: barBgColor }">
5
5
  <view class="hy-tabBar--container">
6
6
  <view
7
- :class="[
8
- 'hy-tabBar--container__item',
9
- 'list',
10
- current === i ? 'is-active' : '',
11
- ]"
7
+ :class="['hy-tabBar--container__item', 'list', current === i ? 'is-active' : '']"
12
8
  v-for="(item, i) in list"
13
9
  :key="i"
14
10
  @click="checkItem(i)"
@@ -31,9 +27,7 @@
31
27
  ></HyBadge>
32
28
  <HyIcon :name="item.icon" :color="color" size="25"></HyIcon>
33
29
  </view>
34
- <text class="text" :style="[{ color: color }]">{{
35
- item.name
36
- }}</text>
30
+ <text class="text" :style="[{ color: color }]">{{ item.name }}</text>
37
31
  <text class="circle"></text>
38
32
  </view>
39
33
  </view>
@@ -49,38 +43,53 @@
49
43
  </view>
50
44
  </template>
51
45
 
46
+ <script lang="ts">
47
+ export default {
48
+ name: 'hy-switch',
49
+ options: {
50
+ addGlobalClass: true,
51
+ virtualHost: true,
52
+ styleIsolation: 'shared',
53
+ },
54
+ }
55
+ </script>
56
+
52
57
  <script setup lang="ts">
53
- import { ref, toRefs, watch } from "vue";
54
- import defaultProps from "./props";
55
- import type IProps from "./typing";
58
+ import { ref, toRefs, watch } from 'vue'
59
+ import defaultProps from './props'
60
+ import type IProps from './typing'
56
61
 
57
62
  // 组件
58
- import HyIcon from "../hy-icon/hy-icon.vue";
59
- import HyBadge from "../hy-badge/hy-badge.vue";
63
+ import HyIcon from '../hy-icon/hy-icon.vue'
64
+ import HyBadge from '../hy-badge/hy-badge.vue'
65
+
66
+ /**
67
+ * 一般用于导航轮播,广告展示等场景,可开箱即用
68
+ * @displayName hy-swiper
69
+ */
70
+ defineOptions({})
60
71
 
61
- const props = withDefaults(defineProps<IProps>(), defaultProps);
62
- const { modelValue, baseBgColor } = toRefs(props);
63
- const emit = defineEmits(["clickTab"]);
72
+ const props = withDefaults(defineProps<IProps>(), defaultProps)
73
+ const { modelValue, baseBgColor } = toRefs(props)
74
+ const emit = defineEmits(['clickTab'])
64
75
 
65
- const baseBackgroundColor = baseBgColor.value
66
- ? baseBgColor.value
67
- : "var(--hy-background)";
68
- const current = ref(0);
76
+ const baseBackgroundColor = baseBgColor.value ? baseBgColor.value : 'var(--hy-background)'
77
+ const current = ref(0)
69
78
  watch(
70
79
  () => modelValue.value,
71
80
  (newVal) => {
72
- current.value = newVal;
81
+ current.value = newVal
73
82
  },
74
- );
83
+ )
75
84
 
76
85
  const checkItem = (index: number) => {
77
- current.value = index;
78
- emit("clickTab", index);
79
- };
86
+ current.value = index
87
+ emit('clickTab', index)
88
+ }
80
89
  </script>
81
90
 
82
91
  <style lang="scss" scoped>
83
- @import "./index.scss";
92
+ @import './index.scss';
84
93
  .hy-tabBar {
85
94
  background: v-bind(baseBackgroundColor);
86
95
  &--indicator {
@@ -98,11 +98,6 @@
98
98
  </template>
99
99
 
100
100
  <script lang="ts">
101
- /**
102
- * 该组件是一个tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
103
- * @displayName hy-tabs
104
- */
105
- defineOptions({})
106
101
  export default {
107
102
  name: 'hy-tabs',
108
103
  options: {
@@ -114,25 +109,23 @@ export default {
114
109
  </script>
115
110
 
116
111
  <script setup lang="ts">
117
- import {
118
- computed,
119
- type CSSProperties,
120
- toRefs,
121
- ref,
122
- watch,
123
- nextTick,
124
- onMounted,
125
- getCurrentInstance,
126
- PropType,
127
- } from 'vue'
112
+ import { computed, toRefs, ref, watch, nextTick, onMounted, getCurrentInstance } from 'vue'
113
+ import type { CSSProperties, PropType } from 'vue'
128
114
  import type { ITabsEmits } from './typing'
129
115
  import type { TabsItemVo } from './typing'
116
+ import type HyBadgeProps from '../hy-badge/typing'
130
117
  import { addUnit, getPx, getRect, sleep } from '../../utils'
131
118
 
132
119
  // 组件
133
120
  import HyBadge from '../hy-badge/hy-badge.vue'
134
121
  import HyIcon from '../hy-icon/hy-icon.vue'
135
122
 
123
+ /**
124
+ * 该组件是一个tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
125
+ * @displayName hy-tabs
126
+ */
127
+ defineOptions({})
128
+
136
129
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
137
130
  const props = defineProps({
138
131
  /** 标签数组,元素为对象,如[{name: '推荐'}] */
@@ -147,7 +140,7 @@ const props = defineProps({
147
140
  },
148
141
  /** 从list元素对象中读取的键名 */
149
142
  keyName: {
150
- type: Number,
143
+ type: String,
151
144
  default: 'name',
152
145
  },
153
146
  /** 滑块移动一次所需的时间,单位秒 */
@@ -158,9 +151,15 @@ const props = defineProps({
158
151
  /** 滑块颜色 */
159
152
  lineColor: String,
160
153
  /** 菜单选择中时的样式 */
161
- activeStyle: Object as PropType<CSSProperties>,
154
+ activeStyle: {
155
+ type: Object as PropType<CSSProperties>,
156
+ default: {},
157
+ },
162
158
  /** 菜单非选中时的样式 */
163
- inactiveStyle: Object as PropType<CSSProperties>,
159
+ inactiveStyle: {
160
+ type: Object as PropType<CSSProperties>,
161
+ default: {},
162
+ },
164
163
  /** 滑块长度 */
165
164
  lineWidth: {
166
165
  type: [String, Number],
@@ -188,8 +187,16 @@ const props = defineProps({
188
187
  type: Boolean,
189
188
  default: true,
190
189
  },
190
+ /**
191
+ * @description 徽标props全局定义
192
+ * */
193
+ propsBadge: Object as PropType<HyBadgeProps>,
191
194
  /** 标签左侧图标样式自定义 */
192
195
  iconStyle: Object as PropType<CSSProperties>,
196
+ /** 定义需要用到的外部样式 */
197
+ customStyle: Object as PropType<CSSProperties>,
198
+ /** 自定义外部类名 */
199
+ customClass: String,
193
200
  })
194
201
  const { list, current, activeStyle, lineWidth, inactiveStyle } = toRefs(props)
195
202
  const emit = defineEmits<ITabsEmits>()
@@ -226,12 +233,12 @@ const textStyle = computed(() => {
226
233
  return (index: number): CSSProperties => {
227
234
  const style: CSSProperties = {}
228
235
  // 取当期是否激活的样式
229
- const customStyle = index == innerCurrent.value ? activeStyle.value : inactiveStyle.value
236
+ const customStyle_1 = index == innerCurrent.value ? activeStyle.value : inactiveStyle.value
230
237
  // 如果当前菜单被禁用,则加上对应颜色,需要在此做处理,是因为nvue下,无法在style样式中通过!import覆盖标签的内联样式
231
238
  if (list.value[index]?.disabled) {
232
239
  style.color = '#c8c9cc'
233
240
  }
234
- return Object.assign(customStyle, style)
241
+ return Object.assign(customStyle_1, style)
235
242
  }
236
243
  })
237
244
 
@@ -38,11 +38,6 @@
38
38
  </template>
39
39
 
40
40
  <script lang="ts">
41
- /**
42
- * tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景
43
- * @displayName hy-tag
44
- */
45
- defineOptions({})
46
41
  export default {
47
42
  name: 'hy-tag',
48
43
  options: {
@@ -54,22 +49,29 @@ export default {
54
49
  </script>
55
50
 
56
51
  <script setup lang="ts">
57
- import { computed, type CSSProperties, PropType, toRefs } from 'vue'
52
+ import { computed, toRefs } from 'vue'
53
+ import type { CSSProperties, PropType } from 'vue'
58
54
  import type { ITagEmits } from './typing'
59
55
  import { IconConfig } from '../../config'
60
56
  import { colorGradient } from '../../utils'
61
- import HyIconProps from '../hy-icon/typing'
57
+ import type HyIconProps from '../hy-icon/typing'
62
58
 
63
59
  // 组件
64
60
  import HyTransition from '../hy-transition/hy-transition.vue'
65
61
  import HyIcon from '../hy-icon/hy-icon.vue'
66
62
 
63
+ /**
64
+ * tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景
65
+ * @displayName hy-tag
66
+ */
67
+ defineOptions({})
68
+
67
69
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
68
70
  const props = defineProps({
69
71
  /** 标签的文字内容 */
70
72
  text: String,
71
73
  /** 点击需要传得值 */
72
- name: String,
74
+ name: [String, Number],
73
75
  /**
74
76
  * 标签类型
75
77
  * @values info,primary,success,error,warning
@@ -131,14 +133,9 @@ const props = defineProps({
131
133
  default: true,
132
134
  },
133
135
  /** 组件内置图标,或绝对路径的图片 */
134
- icon: {
135
- type: Object as PropType<HyIconProps>,
136
- default: {},
137
- },
136
+ icon: Object as PropType<HyIconProps>,
138
137
  /** 定义需要用到的外部样式 */
139
- customStyle: {
140
- type: Object as PropType<CSSProperties>,
141
- },
138
+ customStyle: Object as PropType<CSSProperties>,
142
139
  /** 自定义外部类名 */
143
140
  customClass: String,
144
141
  })
@@ -170,8 +167,7 @@ const tagClass = computed((): string[] => {
170
167
  classes.push('hy-tag--disabled')
171
168
  } else {
172
169
  const arr = [
173
- !plain.value && `hy-tag--${type.value}`,
174
- plain.value && `hy-tag--${type.value}--plain`,
170
+ plain.value ? `hy-tag--${type.value}--plain` : `hy-tag--${type.value}`,
175
171
  plain.value && plainFill.value && `hy-tag--${type.value}--plain__fill`,
176
172
  ].filter(Boolean)
177
173
  classes = classes.concat(arr as string[])
@@ -68,7 +68,7 @@ export default interface HyTagProps {
68
68
  customStyle?: CSSProperties
69
69
  }
70
70
 
71
- type TagParamsVo = { value: string; name: string }
71
+ type TagParamsVo = { value: string; name: string | number }
72
72
  export interface ITagEmits {
73
73
  /** 点击标签触发 */
74
74
  (e: 'click', params: TagParamsVo): void
@@ -52,11 +52,6 @@
52
52
  </template>
53
53
 
54
54
  <script lang="ts">
55
- /**
56
- * 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
57
- * @displayName hy-text
58
- */
59
- defineOptions({})
60
55
  export default {
61
56
  name: 'hy-text',
62
57
  options: {
@@ -68,17 +63,24 @@ export default {
68
63
  </script>
69
64
 
70
65
  <script setup lang="ts">
71
- import { computed, type CSSProperties, nextTick, PropType, toRefs } from 'vue'
66
+ import { computed, nextTick, toRefs } from 'vue'
67
+ import type { CSSProperties, PropType } from 'vue'
72
68
  import type { ITextEmits } from './typing'
73
69
  import { addUnit, error, formatName, formatTime, isDate, priceFormat } from '../../utils'
74
70
 
75
71
  // 组件
76
72
  import HyIcon from '../hy-icon/hy-icon.vue'
77
73
 
74
+ /**
75
+ * 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
76
+ * @displayName hy-text
77
+ */
78
+ defineOptions({})
79
+
78
80
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
79
81
  const props = defineProps({
80
82
  /** 显示的值 */
81
- text: String,
83
+ text: [String, Number],
82
84
  /** 主题颜色 */
83
85
  type: String,
84
86
  /** 是否显示 */
@@ -120,22 +122,18 @@ const props = defineProps({
120
122
  default: false,
121
123
  },
122
124
  /** 文本显示的行数,如果设置,超出此行数,将会显示省略号 */
123
- lines: String,
125
+ lines: [String, Number],
124
126
  /** 文本颜色 */
125
127
  color: String,
126
128
  /** 字体大小 */
127
129
  size: {
128
- type: Number,
130
+ type: [String, Number],
129
131
  default: 15,
130
132
  },
131
133
  /** 图标的样式 */
132
134
  iconStyle: {
133
135
  type: Object as unknown as PropType<CSSProperties>,
134
- default() {
135
- return {
136
- fontSize: '15px',
137
- }
138
- },
136
+ default: () => ({ fontSize: '15px' }),
139
137
  },
140
138
  /**
141
139
  * 文字装饰,下划线,中划线等,可选值