hy-app 0.5.2 → 0.5.4
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-avatar/hy-avatar.vue +4 -3
- 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 +5 -4
- package/components/hy-badge/index.scss +0 -1
- package/components/hy-badge/props.ts +11 -4
- 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 +135 -516
- package/components/hy-coupon/props.ts +101 -127
- package/components/hy-coupon/typing.d.ts +147 -146
- package/components/hy-datetime-picker/props.ts +1 -3
- package/components/hy-folding-panel/props.ts +1 -1
- package/components/hy-folding-panel/typing.d.ts +0 -38
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -5
- package/components/hy-folding-panel-item/index.scss +0 -8
- package/components/hy-folding-panel-item/typing.d.ts +14 -0
- 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-icon/hy-icon.vue +3 -8
- 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-list/props.ts +1 -1
- 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-notice-bar/typing.d.ts +2 -0
- package/components/hy-popup/hy-popup.vue +0 -1
- package/components/hy-qrcode/hy-qrcode.vue +69 -3
- package/components/hy-qrcode/index.scss +3 -3
- package/components/hy-qrcode/qrcode.js +1344 -1400
- package/components/hy-rate/hy-rate.vue +0 -1
- package/components/hy-read-more/hy-read-more.vue +1 -1
- package/components/hy-signature/hy-signature.vue +25 -22
- package/components/hy-signature/index.scss +0 -4
- package/components/hy-tabbar/hy-tabbar.vue +137 -0
- package/components/{hy-tabBar → hy-tabbar}/index.scss +30 -30
- package/components/hy-tabbar/props.ts +59 -0
- package/components/hy-tabbar/typing.d.ts +61 -0
- package/components/hy-tabbar-group/README.md +326 -0
- package/components/hy-tabbar-group/hy-tabbar-group.vue +87 -0
- package/components/hy-tabbar-group/index.scss +57 -0
- package/components/hy-tabbar-group/props.ts +78 -0
- package/components/hy-tabbar-group/typing.ts +16 -0
- package/components/hy-tabbar-item/hy-tabbar-item.vue +103 -0
- package/components/hy-tabbar-item/index.scss +43 -0
- package/components/hy-tabbar-item/props.ts +24 -0
- package/components/hy-tabbar-item/typing.ts +22 -0
- package/components/hy-tag/props.ts +8 -2
- package/components/hy-text/props.ts +8 -2
- package/components/hy-textarea/hy-textarea.vue +1 -1
- package/components/hy-textarea/index.scss +8 -7
- package/components/hy-textarea/props.ts +4 -1
- package/components/hy-toast/index.scss +2 -7
- package/components/hy-tooltip/props.ts +1 -3
- package/components/hy-upload/props.ts +1 -1
- package/components/index.ts +177 -177
- package/global.d.ts +87 -85
- 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
- package/components/hy-tabBar/hy-tabBar.vue +0 -109
- package/components/hy-tabBar/props.ts +0 -13
- package/components/hy-tabBar/typing.d.ts +0 -54
|
@@ -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;
|
|
@@ -36,8 +36,7 @@ export default {
|
|
|
36
36
|
import { getCurrentInstance, ref, watch, nextTick } from 'vue'
|
|
37
37
|
import type { IQrcodeEmits } from './typing'
|
|
38
38
|
import QRCode from './qrcode.js'
|
|
39
|
-
import { addUnit, error } from '../../libs'
|
|
40
|
-
import qrCodeProps from './props'
|
|
39
|
+
import { addUnit, error, random } from '../../libs'
|
|
41
40
|
// 组件
|
|
42
41
|
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
43
42
|
import HyImage from '../hy-image/hy-image.vue'
|
|
@@ -48,7 +47,73 @@ import HyImage from '../hy-image/hy-image.vue'
|
|
|
48
47
|
*/
|
|
49
48
|
defineOptions({})
|
|
50
49
|
|
|
51
|
-
const props = defineProps(
|
|
50
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
51
|
+
const props = defineProps({
|
|
52
|
+
/** 实例ID字符串(如果有多个二维码组件必须设置不一样的cid) */
|
|
53
|
+
cid: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: 'hy-qrcode-canvas_' + random(1, 1000)
|
|
56
|
+
},
|
|
57
|
+
/** 二维码大小 */
|
|
58
|
+
size: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: 200
|
|
61
|
+
},
|
|
62
|
+
/** 二维码内容 */
|
|
63
|
+
text: String,
|
|
64
|
+
/** 是否显示二维码 */
|
|
65
|
+
show: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: true
|
|
68
|
+
},
|
|
69
|
+
/** 二维码背景色 */
|
|
70
|
+
background: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '#ffffff'
|
|
73
|
+
},
|
|
74
|
+
/** 二维码颜色 */
|
|
75
|
+
foreground: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '#000000'
|
|
78
|
+
},
|
|
79
|
+
/** 定位角点颜色 */
|
|
80
|
+
pdGround: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: '#000000'
|
|
83
|
+
},
|
|
84
|
+
/** 是否是自定义组件 */
|
|
85
|
+
usingComponents: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: true
|
|
88
|
+
},
|
|
89
|
+
/** 容错级别 */
|
|
90
|
+
lv: {
|
|
91
|
+
type: Number,
|
|
92
|
+
default: 3
|
|
93
|
+
},
|
|
94
|
+
/** 二维码中间图标 */
|
|
95
|
+
icon: String,
|
|
96
|
+
/** 二维码中间图标大小 */
|
|
97
|
+
iconSize: {
|
|
98
|
+
type: Number,
|
|
99
|
+
default: 40
|
|
100
|
+
},
|
|
101
|
+
/** 显示加载状态 */
|
|
102
|
+
showLoading: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true
|
|
105
|
+
},
|
|
106
|
+
/** 加载中提示语 */
|
|
107
|
+
loadingText: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: '二维码生成中...'
|
|
110
|
+
},
|
|
111
|
+
/** 是否预览 */
|
|
112
|
+
allowPreview: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: false
|
|
115
|
+
}
|
|
116
|
+
})
|
|
52
117
|
const emit = defineEmits<IQrcodeEmits>()
|
|
53
118
|
|
|
54
119
|
const instance = getCurrentInstance()
|
|
@@ -73,6 +138,7 @@ const initQrCode = () => {
|
|
|
73
138
|
image: props.icon, // 二维码图标
|
|
74
139
|
imageSize: props.iconSize, // 二维码图标大小
|
|
75
140
|
cbResult: function (res: any) {
|
|
141
|
+
console.log(res)
|
|
76
142
|
// 生成二维码的回调
|
|
77
143
|
_result(res)
|
|
78
144
|
}
|