hy-app 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/components/hy-action-sheet/index.scss +0 -5
  2. package/components/hy-back-top/hy-back-top.vue +10 -9
  3. package/components/hy-back-top/props.ts +5 -3
  4. package/components/hy-badge/hy-badge.vue +2 -1
  5. package/components/hy-badge/props.ts +5 -3
  6. package/components/hy-button/hy-button.vue +5 -5
  7. package/components/hy-button/index.scss +9 -0
  8. package/components/hy-button/props.ts +11 -6
  9. package/components/hy-coupon/hy-coupon.vue +159 -167
  10. package/components/hy-coupon/index.scss +130 -516
  11. package/components/hy-coupon/props.ts +98 -127
  12. package/components/hy-coupon/typing.d.ts +147 -146
  13. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +1 -3
  14. package/components/hy-folding-panel-item/index.scss +0 -8
  15. package/components/hy-form-group/hy-form-group.vue +308 -511
  16. package/components/hy-form-group/index.scss +0 -33
  17. package/components/hy-form-group/props.ts +103 -13
  18. package/components/hy-form-group/typing.d.ts +0 -77
  19. package/components/hy-form-item/hy-form-item.vue +3 -3
  20. package/components/hy-input/hy-input.vue +16 -10
  21. package/components/hy-input/index.scss +4 -0
  22. package/components/hy-input/props.ts +2 -2
  23. package/components/hy-notice-bar/hy-column-notice.vue +63 -70
  24. package/components/hy-notice-bar/hy-row-notice.vue +92 -110
  25. package/components/hy-notice-bar/index.scss +2 -4
  26. package/components/hy-notice-bar/props.ts +4 -1
  27. package/components/hy-qrcode/hy-qrcode.vue +1 -1
  28. package/components/hy-qrcode/index.scss +1 -0
  29. package/components/hy-qrcode/qrcode.js +1208 -1402
  30. package/components/hy-rate/hy-rate.vue +0 -1
  31. package/components/hy-read-more/hy-read-more.vue +1 -1
  32. package/components/hy-textarea/hy-textarea.vue +1 -1
  33. package/components/hy-textarea/index.scss +8 -7
  34. package/components/hy-toast/index.scss +2 -7
  35. package/libs/css/common.scss +0 -5
  36. package/libs/typing/modules/form.ts +159 -163
  37. package/package.json +2 -2
  38. package/web-types.json +1 -1
  39. package/components/hy-coupon/README.md +0 -133
@@ -1,139 +1,121 @@
1
1
  <template>
2
- <view class="hy-notice" @tap="clickHandler">
3
- <slot name="icon">
4
- <view class="hy-notice__left-icon" v-if="icon">
5
- <HyIcon :name="icon" :color="color" size="19"></HyIcon>
6
- </view>
7
- </slot>
8
- <view class="hy-notice__content" ref="hy-notice__content">
9
- <view
10
- ref="hy-notice__content--text"
11
- class="hy-notice__content--text"
12
- :style="animationStyle"
13
- >
14
- <text
15
- v-for="(item, index) in innerText"
16
- :key="index"
17
- :style="textStyle"
18
- >{{ item }}</text
19
- >
20
- </view>
2
+ <view class="hy-notice" @tap="clickHandler">
3
+ <slot name="icon">
4
+ <view class="hy-notice__left-icon" v-if="icon">
5
+ <hy-icon :name="icon" :color="color" size="19"></hy-icon>
6
+ </view>
7
+ </slot>
8
+ <view class="hy-notice__content" ref="hy-notice__content">
9
+ <view
10
+ ref="hy-notice__content--text"
11
+ class="hy-notice__content--text"
12
+ :style="animationStyle"
13
+ >
14
+ <text v-for="(item, index) in innerText" :key="index" :style="textStyle">{{
15
+ item
16
+ }}</text>
17
+ </view>
18
+ </view>
19
+ <view class="hy-notice__right-icon" v-if="['link', 'closable'].includes(mode)">
20
+ <hy-icon
21
+ v-if="mode === 'link'"
22
+ :name="IconConfig.RIGHT"
23
+ :size="17"
24
+ :color="color"
25
+ ></hy-icon>
26
+ <hy-icon
27
+ v-if="mode === 'closable'"
28
+ @click="close"
29
+ :name="IconConfig.CLOSE"
30
+ :size="16"
31
+ :color="color"
32
+ ></hy-icon>
33
+ </view>
21
34
  </view>
22
- <view
23
- class="hy-notice__right-icon"
24
- v-if="['link', 'closable'].includes(mode)"
25
- >
26
- <HyIcon
27
- v-if="mode === 'link'"
28
- :name="IconConfig.RIGHT"
29
- :size="17"
30
- :color="color"
31
- ></HyIcon>
32
- <HyIcon
33
- v-if="mode === 'closable'"
34
- @click="close"
35
- :name="IconConfig.CLOSE"
36
- :size="16"
37
- :color="color"
38
- ></HyIcon>
39
- </view>
40
- </view>
41
35
  </template>
42
36
 
43
37
  <script setup lang="ts">
44
- import {
45
- ref,
46
- watch,
47
- toRefs,
48
- computed,
49
- type CSSProperties,
50
- getCurrentInstance,
51
- } from "vue";
52
- import type IProps from "./typing";
53
- import defaultProps from "./props";
54
- import { addUnit, getRect, sleep, IconConfig } from "../../libs";
38
+ import { ref, watch, toRefs, computed, type CSSProperties, getCurrentInstance } from 'vue'
39
+ import noticeBarProps from './props'
40
+ import { addUnit, getRect, sleep, IconConfig } from '../../libs'
55
41
  // 组件
56
- import HyIcon from "../hy-icon/hy-icon.vue";
42
+ import HyIcon from '../hy-icon/hy-icon.vue'
57
43
 
58
- const props = withDefaults(defineProps<IProps>(), defaultProps);
59
- const { text, speed, fontSize, color } = toRefs(props);
60
- const emit = defineEmits(["click", "close"]);
44
+ const props = defineProps(noticeBarProps)
45
+ const { text, speed, fontSize, color } = toRefs(props)
46
+ const emit = defineEmits(['click', 'close'])
61
47
 
62
- const instance = getCurrentInstance();
63
- const animationDuration = ref<string>("0"); // 动画执行时间
64
- const animationPlayState = ref<string>("paused"); // 动画的开始和结束执行
65
- const initValue = ref<string>("");
48
+ const instance = getCurrentInstance()
49
+ const animationDuration = ref<string>('0') // 动画执行时间
50
+ const animationPlayState = ref<string>('paused') // 动画的开始和结束执行
51
+ const initValue = ref<string>('')
66
52
 
67
53
  watch(
68
- () => text.value,
69
- async (newValue) => {
70
- initValue.value = Array.isArray(newValue) ? newValue.join("") : newValue;
71
- let boxWidth = 0,
72
- textWidth = 0;
73
- // 进行一定的延时
74
- await sleep();
75
- // 查询盒子和文字的宽度
76
- textWidth = (await getRect(".hy-notice__content--text", false, instance))
77
- .width;
78
- boxWidth = (await getRect(".hy-notice__content", false, instance)).width;
79
- // 根据t=s/v(时间=路程/速度),这里为何不需要加上#u-notice-box的宽度,因为中设置了.u-notice-content样式中设置了padding-left: 100%
80
- // 恰巧计算出来的结果中已经包含了#u-notice-box的宽度
81
- animationDuration.value = `${textWidth / speed.value}s`;
82
- // 这里必须这样开始动画,否则在APP上动画速度不会改变
83
- animationPlayState.value = "paused";
84
- await sleep(10);
85
- animationPlayState.value = "running";
86
- },
87
- { immediate: true },
88
- );
54
+ () => text.value,
55
+ async (newValue) => {
56
+ initValue.value = Array.isArray(newValue) ? newValue.join('') : newValue
57
+ let boxWidth = 0,
58
+ textWidth = 0
59
+ // 进行一定的延时
60
+ await sleep()
61
+ // 查询盒子和文字的宽度
62
+ textWidth = (await getRect('.hy-notice__content--text', false, instance)).width
63
+ boxWidth = (await getRect('.hy-notice__content', false, instance)).width
64
+ // 根据t=s/v(时间=路程/速度),这里为何不需要加上#u-notice-box的宽度,因为中设置了.u-notice-content样式中设置了padding-left: 100%
65
+ // 恰巧计算出来的结果中已经包含了#u-notice-box的宽度
66
+ animationDuration.value = `${textWidth / speed.value}s`
67
+ // 这里必须这样开始动画,否则在APP上动画速度不会改变
68
+ animationPlayState.value = 'paused'
69
+ await sleep(10)
70
+ animationPlayState.value = 'running'
71
+ },
72
+ { immediate: true }
73
+ )
89
74
 
90
75
  /**
91
76
  * @description 文字内容的样式
92
77
  * */
93
78
  const textStyle = computed<CSSProperties>(() => {
94
- let style: CSSProperties = {};
95
- style.whiteSpace = "nowrap !important";
96
- style.color = color.value;
97
- style.fontSize = addUnit(fontSize.value);
98
- return style;
99
- });
79
+ let style: CSSProperties = {}
80
+ style.whiteSpace = 'nowrap !important'
81
+ style.color = color.value
82
+ style.fontSize = addUnit(fontSize.value)
83
+ return style
84
+ })
100
85
  /**
101
86
  * @description 动画的样式
102
87
  * */
103
88
  const animationStyle = computed<CSSProperties>(() => {
104
- let style: CSSProperties = {};
105
- style.animationDuration = animationDuration.value;
106
- style.animationPlayState = animationPlayState.value;
107
- return style;
108
- });
89
+ let style: CSSProperties = {}
90
+ style.animationDuration = animationDuration.value
91
+ style.animationPlayState = animationPlayState.value
92
+ return style
93
+ })
109
94
  // 内部对用户传入的数据进一步分割,放到多个text标签循环,否则如果用户传入的字符串很长(100个字符以上)
110
95
  // 放在一个text标签中进行滚动,在低端安卓机上,动画可能会出现抖动现象,需要分割到多个text中可解决此问题
111
96
  const innerText = computed(() => {
112
- let result = [],
113
- // 每组text标签的字符长度
114
- len = 20;
115
- const textArr = initValue.value.split("");
116
- for (let i = 0; i < textArr.length; i += len) {
117
- // 对拆分的后的text进行slice分割,得到的为数组再进行join拼接为字符串
118
- result.push(textArr.slice(i, i + len).join(""));
119
- }
120
- return result;
121
- });
97
+ let result = [],
98
+ // 每组text标签的字符长度
99
+ len = 20
100
+ const textArr = initValue.value.split('')
101
+ for (let i = 0; i < textArr.length; i += len) {
102
+ // 对拆分的后的text进行slice分割,得到的为数组再进行join拼接为字符串
103
+ result.push(textArr.slice(i, i + len).join(''))
104
+ }
105
+ return result
106
+ })
122
107
 
123
- /**
124
- * @description 点击通告栏
125
- * */
108
+ // 点击通告栏
126
109
  const clickHandler = (index: number) => {
127
- emit("click", index);
128
- };
129
- /**
130
- * @description 点击关闭按钮
131
- * */
110
+ emit('click', index)
111
+ }
112
+
113
+ // 点击关闭按钮
132
114
  const close = () => {
133
- emit("close");
134
- };
115
+ emit('close')
116
+ }
135
117
  </script>
136
118
 
137
119
  <style lang="scss" scoped>
138
- @import "./index.scss";
120
+ @import './index.scss';
139
121
  </style>
@@ -27,9 +27,6 @@
27
27
  @include e(right-icon) {
28
28
  margin-left: 5px;
29
29
  align-items: center;
30
- :deep(.hy-icon) {
31
- color: $hy-warning;
32
- }
33
30
  }
34
31
 
35
32
  @include e(content) {
@@ -63,7 +60,8 @@
63
60
  @include m(item) {
64
61
  @include flex;
65
62
  align-items: center;
66
- overflow: hidden;
63
+ height: 100%;
64
+ //overflow: hidden;
67
65
 
68
66
  @include e(text) {
69
67
  font-size: 14px;
@@ -32,7 +32,10 @@ const noticeBarProps = {
32
32
  * */
33
33
  mode: String,
34
34
  /** 文字颜色,各图标也会使用文字颜色 */
35
- color: String,
35
+ color: {
36
+ type: String,
37
+ default: '#ff9900'
38
+ },
36
39
  /** 背景颜色 */
37
40
  bgColor: String,
38
41
  /** 水平滚动时的滚动速度,即每秒滚动多少px(px),这有利于控制文字无论多少时,都能有一个恒定的速度 */
@@ -6,7 +6,7 @@
6
6
  <canvas
7
7
  class="hy-qrcode__content--canvas"
8
8
  :id="cid"
9
- type="2d"
9
+ :canvas-id="cid"
10
10
  :style="{ width: addUnit(size), height: addUnit(size) }"
11
11
  />
12
12
  <!-- #endif -->
@@ -6,6 +6,7 @@
6
6
  position: relative;
7
7
 
8
8
  @include m(canvas) {
9
+ // 移除fixed定位,确保canvas在H5端能正确绘制
9
10
  position: fixed;
10
11
  top: -99999rpx;
11
12
  left: -99999rpx;