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.
- package/components/hy-action-sheet/index.scss +0 -5
- package/components/hy-back-top/hy-back-top.vue +10 -9
- package/components/hy-back-top/props.ts +5 -3
- package/components/hy-badge/hy-badge.vue +2 -1
- package/components/hy-badge/props.ts +5 -3
- package/components/hy-button/hy-button.vue +5 -5
- package/components/hy-button/index.scss +9 -0
- package/components/hy-button/props.ts +11 -6
- package/components/hy-coupon/hy-coupon.vue +159 -167
- package/components/hy-coupon/index.scss +130 -516
- package/components/hy-coupon/props.ts +98 -127
- package/components/hy-coupon/typing.d.ts +147 -146
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +1 -3
- package/components/hy-folding-panel-item/index.scss +0 -8
- package/components/hy-form-group/hy-form-group.vue +308 -511
- package/components/hy-form-group/index.scss +0 -33
- package/components/hy-form-group/props.ts +103 -13
- package/components/hy-form-group/typing.d.ts +0 -77
- package/components/hy-form-item/hy-form-item.vue +3 -3
- package/components/hy-input/hy-input.vue +16 -10
- package/components/hy-input/index.scss +4 -0
- package/components/hy-input/props.ts +2 -2
- package/components/hy-notice-bar/hy-column-notice.vue +63 -70
- package/components/hy-notice-bar/hy-row-notice.vue +92 -110
- package/components/hy-notice-bar/index.scss +2 -4
- package/components/hy-notice-bar/props.ts +4 -1
- package/components/hy-qrcode/hy-qrcode.vue +1 -1
- package/components/hy-qrcode/index.scss +1 -0
- package/components/hy-qrcode/qrcode.js +1208 -1402
- package/components/hy-rate/hy-rate.vue +0 -1
- package/components/hy-read-more/hy-read-more.vue +1 -1
- package/components/hy-textarea/hy-textarea.vue +1 -1
- package/components/hy-textarea/index.scss +8 -7
- package/components/hy-toast/index.scss +2 -7
- package/libs/css/common.scss +0 -5
- package/libs/typing/modules/form.ts +159 -163
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-coupon/README.md +0 -133
|
@@ -1,139 +1,121 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
>
|
|
20
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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
|
|
42
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
57
43
|
|
|
58
|
-
const props =
|
|
59
|
-
const { text, speed, fontSize, color } = toRefs(props)
|
|
60
|
-
const emit = defineEmits([
|
|
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>(
|
|
64
|
-
const animationPlayState = ref<string>(
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* */
|
|
110
|
+
emit('click', index)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 点击关闭按钮
|
|
132
114
|
const close = () => {
|
|
133
|
-
|
|
134
|
-
}
|
|
115
|
+
emit('close')
|
|
116
|
+
}
|
|
135
117
|
</script>
|
|
136
118
|
|
|
137
119
|
<style lang="scss" scoped>
|
|
138
|
-
@import
|
|
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
|
-
|
|
63
|
+
height: 100%;
|
|
64
|
+
//overflow: hidden;
|
|
67
65
|
|
|
68
66
|
@include e(text) {
|
|
69
67
|
font-size: 14px;
|