hy-app 0.6.8 → 0.7.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.
- package/attributes.json +1 -1
- package/components/hy-action-sheet/index.scss +2 -2
- package/components/hy-avatar/hy-avatar.vue +12 -5
- package/components/hy-avatar/index.scss +2 -2
- package/components/hy-avatar/props.ts +4 -2
- package/components/hy-avatar/typing.d.ts +8 -1
- package/components/hy-calendar/hy-calendar.vue +1 -0
- package/components/hy-calendar/month.vue +25 -5
- package/components/hy-calendar/props.ts +1 -1
- package/components/hy-cascader/hy-cascader.vue +503 -0
- package/components/hy-cascader/index.scss +84 -0
- package/components/hy-cascader/props.ts +88 -0
- package/components/hy-cascader/typing.d.ts +34 -0
- package/components/hy-cell-item/index.scss +8 -9
- package/components/hy-check-button/typing.d.ts +12 -7
- package/components/hy-code-input/hy-code-input.vue +33 -11
- package/components/hy-code-input/index.scss +2 -2
- package/components/hy-code-input/typing.d.ts +4 -0
- package/components/hy-config-provider/hy-config-provider.vue +58 -53
- package/components/hy-config-provider/props.ts +1 -1
- package/components/hy-datetime-picker/props.ts +1 -1
- package/components/hy-datetime-picker/typing.d.ts +1 -1
- package/components/hy-dropdown/typing.d.ts +5 -0
- package/components/hy-float-button/index.scss +1 -1
- package/components/hy-form/typing.d.ts +6 -0
- package/components/hy-form-item/typing.d.ts +1 -1
- package/components/hy-grid/hy-grid.vue +12 -12
- package/components/hy-grid/index.scss +1 -2
- package/components/hy-grid/props.ts +7 -2
- package/components/hy-grid/typing.d.ts +1 -1
- package/components/hy-icon/typing.d.ts +52 -9
- package/components/hy-index-bar/index.scss +1 -1
- package/components/hy-keyboard/constants.ts +83 -0
- package/components/hy-keyboard/hy-keyboard.vue +375 -0
- package/components/hy-keyboard/index.scss +73 -0
- package/components/hy-keyboard/key/index.scss +79 -0
- package/components/hy-keyboard/key/index.vue +91 -0
- package/components/hy-keyboard/key/types.ts +1 -0
- package/components/hy-keyboard/props.ts +108 -0
- package/components/hy-keyboard/typing.d.ts +18 -0
- package/components/hy-line-progress/index.scss +3 -3
- package/components/hy-menu/index.scss +1 -1
- package/components/hy-modal/index.scss +2 -2
- package/components/hy-modal/typing.d.ts +2 -2
- package/components/hy-notice-bar/hy-column-notice.vue +54 -94
- package/components/hy-notice-bar/hy-notice-bar.vue +128 -96
- package/components/hy-notice-bar/hy-row-notice.vue +89 -121
- package/components/hy-notice-bar/index.scss +1 -1
- package/components/hy-notice-bar/props.ts +86 -85
- package/components/hy-notify/hy-notify.vue +9 -9
- package/components/hy-notify/typing.d.ts +22 -0
- package/components/hy-picker/hy-picker.vue +126 -149
- package/components/hy-picker/props.ts +4 -1
- package/components/hy-picker/typing.d.ts +22 -0
- package/components/hy-popover/index.scss +6 -6
- package/components/hy-popup/index.scss +6 -5
- package/components/hy-price/hy-price.vue +52 -23
- package/components/hy-price/props.ts +54 -54
- package/components/hy-radio/props.ts +1 -1
- package/components/hy-radio/typing.d.ts +5 -1
- package/components/hy-rolling-num/typing.d.ts +1 -0
- package/components/hy-scroll-list/index.scss +2 -2
- package/components/hy-search/index.scss +1 -1
- package/components/hy-signature/index.scss +1 -1
- package/components/hy-skeleton/index.scss +21 -4
- package/components/hy-slider/index.scss +3 -3
- package/components/hy-steps/hy-steps.vue +1 -1
- package/components/hy-steps/index.scss +3 -3
- package/components/hy-submit-bar/typing.d.ts +3 -3
- package/components/hy-subsection/index.scss +8 -8
- package/components/hy-swipe-action/hy-swipe-action.vue +34 -15
- package/components/hy-swipe-action/index.scss +0 -1
- package/components/hy-swiper/index.scss +2 -2
- package/components/hy-switch/index.scss +3 -3
- package/components/hy-switch/typing.d.ts +4 -0
- package/components/hy-tabbar/props.ts +2 -1
- package/components/hy-tabbar/typing.d.ts +5 -4
- package/components/hy-tabbar-group/index.scss +2 -2
- package/components/hy-tabs/hy-tabs.vue +338 -336
- package/components/hy-tabs/index.scss +7 -7
- package/components/hy-tabs/typing.d.ts +41 -33
- package/components/hy-tag/index.scss +1 -1
- package/components/hy-textarea/hy-textarea.vue +2 -2
- package/components/hy-textarea/index.scss +4 -4
- package/components/hy-textarea/typing.d.ts +4 -0
- package/components/hy-toast/hy-toast.vue +14 -6
- package/components/hy-toast/index.scss +1 -1
- package/components/hy-toast/typing.d.ts +42 -36
- package/components/hy-tooltip/hy-tooltip.vue +1 -1
- package/components/hy-tooltip/index.scss +7 -6
- package/components/hy-tooltip/props.ts +1 -1
- package/components/hy-upload/hy-upload.vue +16 -1
- package/components/hy-upload/index.scss +149 -144
- package/components/hy-warn/index.scss +1 -1
- package/components/index.ts +6 -0
- package/global.d.ts +2 -0
- package/libs/config/icon.ts +442 -430
- package/libs/css/_function.scss +7 -13
- package/libs/css/_mixin.scss +3 -3
- package/libs/css/common.scss +1 -1
- package/libs/css/iconfont.css +445 -441
- package/libs/css/theme.scss +54 -25
- package/libs/locale/lang/en-US.ts +4 -0
- package/libs/locale/lang/zh-CN.ts +4 -0
- package/libs/typing/index.ts +80 -0
- package/package.json +5 -2
- package/tags.json +1 -1
- package/web-types.json +1 -1
- package/components/hy-qrcode/qrcode.js.bak +0 -1434
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
-
|
|
3
|
-
const priceProps = {
|
|
4
|
-
/** 传入金额值 */
|
|
5
|
-
text: {
|
|
6
|
-
type: [String, Number],
|
|
7
|
-
default: 0,
|
|
8
|
-
required: true
|
|
9
|
-
},
|
|
10
|
-
/** 金额符号 */
|
|
11
|
-
symbol: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: '¥'
|
|
14
|
-
},
|
|
15
|
-
/** 比例大小 */
|
|
16
|
-
ratio: {
|
|
17
|
-
type: Number,
|
|
18
|
-
default: 1.4
|
|
19
|
-
},
|
|
20
|
-
/** 保留小数点后几位数 */
|
|
21
|
-
num: {
|
|
22
|
-
type: Number,
|
|
23
|
-
default: 2
|
|
24
|
-
},
|
|
25
|
-
/** 字体颜色 */
|
|
26
|
-
color: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: '#FE3232'
|
|
29
|
-
},
|
|
30
|
-
/** 字体大小 */
|
|
31
|
-
size: {
|
|
32
|
-
type: [Number, String],
|
|
33
|
-
default: 12
|
|
34
|
-
},
|
|
35
|
-
/** 字体粗细 */
|
|
36
|
-
weight: {
|
|
37
|
-
type: Number,
|
|
38
|
-
default: 500
|
|
39
|
-
},
|
|
40
|
-
/** 是否倾斜 */
|
|
41
|
-
slant: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: false
|
|
44
|
-
},
|
|
45
|
-
/** 定义需要用到的外部样式 */
|
|
46
|
-
customStyle: {
|
|
47
|
-
type: Object as PropType<CSSProperties>,
|
|
48
|
-
default: () => {}
|
|
49
|
-
},
|
|
50
|
-
/** 自定义外部类名 */
|
|
51
|
-
customClass: String
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default priceProps
|
|
1
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
const priceProps = {
|
|
4
|
+
/** 传入金额值 */
|
|
5
|
+
text: {
|
|
6
|
+
type: [String, Number],
|
|
7
|
+
default: 0,
|
|
8
|
+
required: true
|
|
9
|
+
},
|
|
10
|
+
/** 金额符号 */
|
|
11
|
+
symbol: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: '¥'
|
|
14
|
+
},
|
|
15
|
+
/** 比例大小 */
|
|
16
|
+
ratio: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 1.4
|
|
19
|
+
},
|
|
20
|
+
/** 保留小数点后几位数 */
|
|
21
|
+
num: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 2
|
|
24
|
+
},
|
|
25
|
+
/** 字体颜色 */
|
|
26
|
+
color: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '#FE3232'
|
|
29
|
+
},
|
|
30
|
+
/** 字体大小 */
|
|
31
|
+
size: {
|
|
32
|
+
type: [Number, String],
|
|
33
|
+
default: 12
|
|
34
|
+
},
|
|
35
|
+
/** 字体粗细 */
|
|
36
|
+
weight: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 500
|
|
39
|
+
},
|
|
40
|
+
/** 是否倾斜 */
|
|
41
|
+
slant: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
/** 定义需要用到的外部样式 */
|
|
46
|
+
customStyle: {
|
|
47
|
+
type: Object as PropType<CSSProperties>,
|
|
48
|
+
default: () => {}
|
|
49
|
+
},
|
|
50
|
+
/** 自定义外部类名 */
|
|
51
|
+
customClass: String
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default priceProps
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import type radioProps from './props'
|
|
3
|
+
import type { CheckboxColumnsVo } from '../../index'
|
|
4
|
+
|
|
5
|
+
export interface HyRadioProps extends ExtractPropTypes<typeof radioProps> {}
|
|
2
6
|
|
|
3
7
|
export interface IRadioEmits {
|
|
4
8
|
/** 选择触发 */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export interface HyRollingNum {}
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
@include m(line) {
|
|
29
29
|
width: 60px;
|
|
30
30
|
height: 4px;
|
|
31
|
-
border-radius: $hy-
|
|
31
|
+
border-radius: $hy-radius-semicircle;
|
|
32
32
|
overflow: hidden;
|
|
33
33
|
background-color: $hy-background--empty;
|
|
34
34
|
|
|
35
35
|
@include e(bar) {
|
|
36
36
|
width: 20px;
|
|
37
37
|
height: 4px;
|
|
38
|
-
border-radius: $hy-
|
|
38
|
+
border-radius: $hy-radius-semicircle;
|
|
39
39
|
background-color: $hy-primary;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -42,7 +42,7 @@ $hy-search-close-size: 20px !default;
|
|
|
42
42
|
@include e(close) {
|
|
43
43
|
width: $hy-search-close-size;
|
|
44
44
|
height: $hy-search-close-size;
|
|
45
|
-
border-radius: $hy-
|
|
45
|
+
border-radius: $hy-radius-circle;
|
|
46
46
|
background-color: $hy-background--track;
|
|
47
47
|
@include flex(row);
|
|
48
48
|
align-items: center;
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
@use "../../libs/css/theme" as *;
|
|
2
2
|
@use "../../libs/css/mixin" as *;
|
|
3
3
|
|
|
4
|
+
@include b(theme--dark) {
|
|
5
|
+
.hy-skeleton--animation-gradient {
|
|
6
|
+
&::after {
|
|
7
|
+
content: ' ';
|
|
8
|
+
position: absolute;
|
|
9
|
+
animation: wd-skeleton-gradient 1.5s linear 2s infinite;
|
|
10
|
+
background: linear-gradient(
|
|
11
|
+
90deg,
|
|
12
|
+
transparent,
|
|
13
|
+
rgba(255, 255, 255, 0.1),
|
|
14
|
+
transparent
|
|
15
|
+
);
|
|
16
|
+
inset: 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
4
21
|
|
|
5
22
|
@include b(skeleton) {
|
|
6
23
|
box-sizing: border-box;
|
|
@@ -17,7 +34,7 @@
|
|
|
17
34
|
}
|
|
18
35
|
}
|
|
19
36
|
@include e(col) {
|
|
20
|
-
border-radius: $hy-
|
|
37
|
+
border-radius: $hy-radius-sm;
|
|
21
38
|
background-color: $hy-background--skeleton;
|
|
22
39
|
display: flex;
|
|
23
40
|
align-items: center;
|
|
@@ -32,20 +49,20 @@
|
|
|
32
49
|
&-text {
|
|
33
50
|
width: 100%;
|
|
34
51
|
height: 20px;
|
|
35
|
-
border-radius: $hy-
|
|
52
|
+
border-radius: $hy-radius-sm;
|
|
36
53
|
}
|
|
37
54
|
|
|
38
55
|
&-rect {
|
|
39
56
|
width: 100%;
|
|
40
57
|
height: 20px;
|
|
41
|
-
border-radius: $hy-
|
|
58
|
+
border-radius: $hy-radius-base;
|
|
42
59
|
}
|
|
43
60
|
|
|
44
61
|
&-circle {
|
|
45
62
|
flex-shrink: 0;
|
|
46
63
|
width: 48px;
|
|
47
64
|
height: 48px;
|
|
48
|
-
border-radius: $hy-
|
|
65
|
+
border-radius: $hy-radius-circle;
|
|
49
66
|
}
|
|
50
67
|
}
|
|
51
68
|
@include m(animation) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
flex: 1;
|
|
16
16
|
@include flex(column);
|
|
17
17
|
position: relative;
|
|
18
|
-
border-radius: $hy-
|
|
18
|
+
border-radius: $hy-radius-semicircle;
|
|
19
19
|
padding: $hy-border-margin-padding-base $hy-border-margin-padding-lg;
|
|
20
20
|
justify-content: center;
|
|
21
21
|
}
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
@include e(base) {
|
|
36
36
|
background-color: $hy-background--empty;
|
|
37
|
-
border-radius: $hy-
|
|
37
|
+
border-radius: $hy-radius-semicircle;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/* #ifndef APP-NVUE */
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
@include e(gap) {
|
|
53
53
|
position: relative;
|
|
54
|
-
border-radius: $hy-
|
|
54
|
+
border-radius: $hy-radius-semicircle;
|
|
55
55
|
transition: width 0.2s;
|
|
56
56
|
background-color: $hy-primary;
|
|
57
57
|
&-0 {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
:class="[`hy-steps-item__content--${direction}`]"
|
|
92
92
|
:style="[contentStyle]"
|
|
93
93
|
>
|
|
94
|
-
<slot v-if="$slots.content" name="content" :
|
|
94
|
+
<slot v-if="$slots.content" name="content" :item="item" :index="i"></slot>
|
|
95
95
|
<template v-else>
|
|
96
96
|
<slot
|
|
97
97
|
v-if="$slots.title"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
align-items: center;
|
|
41
41
|
position: relative;
|
|
42
42
|
background-color: transparent;
|
|
43
|
-
border-radius: $hy-
|
|
43
|
+
border-radius: $hy-radius-semicircle;
|
|
44
44
|
|
|
45
45
|
/* 选择 */
|
|
46
46
|
&.process {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
@include e(item) {
|
|
71
71
|
width: 10px;
|
|
72
72
|
height: 10px;
|
|
73
|
-
border-radius: $hy-
|
|
73
|
+
border-radius: $hy-radius-circle;
|
|
74
74
|
background-color: $hy-info;
|
|
75
75
|
border: none;
|
|
76
76
|
}
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
box-sizing: border-box;
|
|
90
90
|
flex-shrink: 0;
|
|
91
91
|
/* #endif */
|
|
92
|
-
border-radius: $hy-
|
|
92
|
+
border-radius: $hy-radius-semicircle;
|
|
93
93
|
border: $hy-border-line;
|
|
94
94
|
@include flex(row);
|
|
95
95
|
align-items: center;
|
|
@@ -2,15 +2,15 @@ import type BadgeProps from '../hy-badge/props'
|
|
|
2
2
|
|
|
3
3
|
export interface SubmitBarIconMenus {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* icon图标
|
|
6
6
|
* */
|
|
7
7
|
icon: string
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 文本
|
|
10
10
|
* */
|
|
11
11
|
text: string
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 徽标值
|
|
14
14
|
* */
|
|
15
15
|
badge?: BadgeProps['badge']
|
|
16
16
|
[key: string]: any
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
height: 35px;
|
|
16
16
|
background-color: $hy-background--3;
|
|
17
17
|
padding: 3px;
|
|
18
|
-
border-radius: $hy-
|
|
18
|
+
border-radius: $hy-radius-sm;
|
|
19
19
|
align-items: stretch;
|
|
20
20
|
|
|
21
21
|
@include m(bar) {
|
|
22
22
|
background-color: $hy-background--container !important;
|
|
23
|
-
border-radius: $hy-
|
|
23
|
+
border-radius: $hy-radius-sm;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
background-color: $hy-primary;
|
|
39
39
|
|
|
40
40
|
@include m(first) {
|
|
41
|
-
border-radius: $hy-
|
|
41
|
+
border-radius: $hy-radius-sm 0 0 $hy-radius-sm;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
@include m(center) {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
@include m(last) {
|
|
49
|
-
border-radius: 0 $hy-
|
|
49
|
+
border-radius: 0 $hy-radius-sm $hy-radius-sm 0;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
@include m(first) {
|
|
70
|
-
border-top-left-radius: $hy-
|
|
71
|
-
border-bottom-left-radius: $hy-
|
|
70
|
+
border-top-left-radius: $hy-radius-sm;
|
|
71
|
+
border-bottom-left-radius: $hy-radius-sm;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
@include m(last) {
|
|
75
|
-
border-top-right-radius: $hy-
|
|
76
|
-
border-bottom-right-radius: $hy-
|
|
75
|
+
border-top-right-radius: $hy-radius-sm;
|
|
76
|
+
border-bottom-right-radius: $hy-radius-sm;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
@include m(text) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<!--注意阻止横向滑动的穿透:横向移动时阻止冒泡-->
|
|
3
3
|
<view
|
|
4
4
|
class="hy-swipe-action"
|
|
5
|
+
:style="touchActionStyle"
|
|
5
6
|
@click.stop="onClick"
|
|
6
7
|
@touchstart="startDrag"
|
|
7
8
|
@touchmove="onDrag"
|
|
@@ -17,7 +18,13 @@
|
|
|
17
18
|
<!--左侧操作-->
|
|
18
19
|
|
|
19
20
|
<!--内容-->
|
|
20
|
-
<view
|
|
21
|
+
<view
|
|
22
|
+
:class="[
|
|
23
|
+
'hy-swipe-action__center',
|
|
24
|
+
centerClass,
|
|
25
|
+
borderBottom && 'hy-border__bottom'
|
|
26
|
+
]"
|
|
27
|
+
>
|
|
21
28
|
<slot></slot>
|
|
22
29
|
</view>
|
|
23
30
|
<!--内容-->
|
|
@@ -29,6 +36,7 @@
|
|
|
29
36
|
<view
|
|
30
37
|
class="hy-swipe-action__right--action__btn"
|
|
31
38
|
v-for="(item, i) in options"
|
|
39
|
+
:key="i"
|
|
32
40
|
:style="item.style"
|
|
33
41
|
@tap.stop="onActiveClick(item, i)"
|
|
34
42
|
>
|
|
@@ -83,11 +91,13 @@ const props = defineProps(swipeActionProps)
|
|
|
83
91
|
const emit = defineEmits<ISwipeActionEmits>()
|
|
84
92
|
const leftClass = `hy-swipe-action__left--${guid()}`
|
|
85
93
|
const rightClass = `hy-swipe-action__right--${guid()}`
|
|
94
|
+
const centerClass = `hy-swipe-action__center--${guid()}`
|
|
86
95
|
|
|
87
96
|
const slots = useSlots()
|
|
88
97
|
const wrapperStyle = ref<string>('')
|
|
98
|
+
const touchActionStyle = ref<Record<string, string>>({ touchAction: 'pan-y' })
|
|
89
99
|
|
|
90
|
-
// 滑动开始时,wrapper的偏移量
|
|
100
|
+
// 滑动开始时,wrapper 的偏移量
|
|
91
101
|
const originOffset = ref<number>(0)
|
|
92
102
|
// wrapper现在的偏移量
|
|
93
103
|
const wrapperOffset = ref<number>(0)
|
|
@@ -150,7 +160,7 @@ function changeState(value?: SwipeActionStatus, old?: SwipeActionStatus) {
|
|
|
150
160
|
}
|
|
151
161
|
|
|
152
162
|
/**
|
|
153
|
-
*
|
|
163
|
+
* 获取左/右操作按钮的宽度
|
|
154
164
|
* @return {Promise<[Number, Number]>} 左宽度、右宽度
|
|
155
165
|
*/
|
|
156
166
|
const getWidths = (): Promise<number[]> => {
|
|
@@ -164,7 +174,7 @@ const getWidths = (): Promise<number[]> => {
|
|
|
164
174
|
])
|
|
165
175
|
}
|
|
166
176
|
/**
|
|
167
|
-
*
|
|
177
|
+
* wrapper滑动函数
|
|
168
178
|
* @param {Number} offset 滑动漂移量
|
|
169
179
|
*/
|
|
170
180
|
function swipeMove(offset = 0) {
|
|
@@ -182,7 +192,7 @@ function swipeMove(offset = 0) {
|
|
|
182
192
|
wrapperOffset.value = offset
|
|
183
193
|
}
|
|
184
194
|
/**
|
|
185
|
-
*
|
|
195
|
+
* click的handler
|
|
186
196
|
* @param position
|
|
187
197
|
*/
|
|
188
198
|
function onClick(position?: SwipeActionPosition) {
|
|
@@ -195,7 +205,7 @@ function onClick(position?: SwipeActionPosition) {
|
|
|
195
205
|
emit('click', position)
|
|
196
206
|
}
|
|
197
207
|
/**
|
|
198
|
-
*
|
|
208
|
+
* 开始滑动
|
|
199
209
|
*/
|
|
200
210
|
function startDrag(event: TouchEvent) {
|
|
201
211
|
if (props.disabled) return
|
|
@@ -203,9 +213,13 @@ function startDrag(event: TouchEvent) {
|
|
|
203
213
|
originOffset.value = wrapperOffset.value
|
|
204
214
|
touch.touchStart(event)
|
|
205
215
|
closeOther(proxy)
|
|
216
|
+
|
|
217
|
+
// 设置 touch-action 为 none,阻止默认的滚动行为
|
|
218
|
+
// 这样可以在 touchmove 中安全调用 preventDefault 而不产生警告
|
|
219
|
+
touchActionStyle.value = { touchAction: 'none' }
|
|
206
220
|
}
|
|
207
221
|
/**
|
|
208
|
-
*
|
|
222
|
+
* 滑动时,逐渐展示按钮
|
|
209
223
|
* @param event
|
|
210
224
|
*/
|
|
211
225
|
function onDrag(event: TouchEvent) {
|
|
@@ -214,22 +228,24 @@ function onDrag(event: TouchEvent) {
|
|
|
214
228
|
touch.touchMove(event)
|
|
215
229
|
if (touch.direction.value === 'vertical') {
|
|
216
230
|
return
|
|
217
|
-
} else {
|
|
218
|
-
event.preventDefault()
|
|
219
|
-
event.stopPropagation()
|
|
220
231
|
}
|
|
221
232
|
|
|
233
|
+
// 阻止默认行为和事件冒泡
|
|
234
|
+
// 由于在 touchstart 时设置了 touch-action: none,这里可以安全调用 preventDefault
|
|
235
|
+
event.preventDefault()
|
|
236
|
+
event.stopPropagation()
|
|
237
|
+
|
|
222
238
|
touching.value = true
|
|
223
239
|
|
|
224
|
-
// 本次滑动,wrapper应该设置的偏移量
|
|
240
|
+
// 本次滑动,wrapper 应该设置的偏移量
|
|
225
241
|
const offset = originOffset.value + touch.deltaX.value
|
|
226
242
|
getWidths().then(([leftWidth, rightWidth]) => {
|
|
227
|
-
// 如果需要想滑出来的按钮不存在,对应的按钮肯定滑不出来,容器处于初始状态。此时需要模拟一下位于此处的start事件。
|
|
243
|
+
// 如果需要想滑出来的按钮不存在,对应的按钮肯定滑不出来,容器处于初始状态。此时需要模拟一下位于此处的 start 事件。
|
|
228
244
|
if ((leftWidth === 0 && offset > 0) || (rightWidth === 0 && offset < 0)) {
|
|
229
245
|
swipeMove(0)
|
|
230
246
|
return startDrag(event)
|
|
231
247
|
}
|
|
232
|
-
// 按钮已经展示完了,再滑动没有任何意义,相当于滑动结束。此时需要模拟一下位于此处的start事件。
|
|
248
|
+
// 按钮已经展示完了,再滑动没有任何意义,相当于滑动结束。此时需要模拟一下位于此处的 start 事件。
|
|
233
249
|
if (leftWidth !== 0 && offset >= leftWidth) {
|
|
234
250
|
swipeMove(leftWidth)
|
|
235
251
|
return startDrag(event)
|
|
@@ -241,7 +257,7 @@ function onDrag(event: TouchEvent) {
|
|
|
241
257
|
})
|
|
242
258
|
}
|
|
243
259
|
/**
|
|
244
|
-
*
|
|
260
|
+
* 滑动结束,自动修正位置
|
|
245
261
|
*/
|
|
246
262
|
function endDrag() {
|
|
247
263
|
if (props.disabled) return
|
|
@@ -249,6 +265,9 @@ function endDrag() {
|
|
|
249
265
|
const THRESHOLD = 0.3
|
|
250
266
|
touching.value = false
|
|
251
267
|
|
|
268
|
+
// 恢复 touch-action,允许正常滚动
|
|
269
|
+
touchActionStyle.value = { touchAction: 'pan-y' }
|
|
270
|
+
|
|
252
271
|
getWidths().then(([leftWidth, rightWidth]) => {
|
|
253
272
|
if (
|
|
254
273
|
originOffset.value < 0 && // 之前展示的是右按钮
|
|
@@ -287,7 +306,7 @@ function endDrag() {
|
|
|
287
306
|
})
|
|
288
307
|
}
|
|
289
308
|
/**
|
|
290
|
-
*
|
|
309
|
+
* 关闭操过按钮,并在合适的时候调用 beforeClose
|
|
291
310
|
*/
|
|
292
311
|
function close(reason: SwipeActionReason, position?: SwipeActionPosition) {
|
|
293
312
|
if (reason === 'swipe' && originOffset.value === 0) {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
@include e(bar) {
|
|
62
62
|
width: 22px;
|
|
63
63
|
height: 4px;
|
|
64
|
-
border-radius: $hy-
|
|
64
|
+
border-radius: $hy-radius-semicircle;
|
|
65
65
|
background-color: #ffffff;
|
|
66
66
|
transition: transform 0.3s;
|
|
67
67
|
}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
@include m(dot) {
|
|
71
71
|
width: 5px;
|
|
72
72
|
height: 5px;
|
|
73
|
-
border-radius: $hy-
|
|
73
|
+
border-radius: $hy-radius-semicircle;
|
|
74
74
|
margin: 0 $hy-border-margin-padding-sm;
|
|
75
75
|
|
|
76
76
|
@include e(active) {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/* #endif */
|
|
9
9
|
background-color: $hy-background--3;
|
|
10
10
|
position: relative;
|
|
11
|
-
border-radius: $hy-
|
|
11
|
+
border-radius: $hy-radius-semicircle;
|
|
12
12
|
transition: background-color 0.4s;
|
|
13
13
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
14
14
|
justify-content: flex-end;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
align-items: center;
|
|
26
26
|
justify-content: center;
|
|
27
27
|
background-color: $hy-background--container;
|
|
28
|
-
border-radius: $hy-
|
|
28
|
+
border-radius: $hy-radius-semicircle;
|
|
29
29
|
box-shadow: 1px 1px 1px 0 rgba(0, 0, 0, 0.25);
|
|
30
30
|
transition-property: transform;
|
|
31
31
|
transition-duration: 0.4s;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
@include e(bg) {
|
|
36
36
|
position: absolute;
|
|
37
|
-
border-radius: $hy-
|
|
37
|
+
border-radius: $hy-radius-semicircle;
|
|
38
38
|
background-color: $hy-background--3;
|
|
39
39
|
transition-property: transform;
|
|
40
40
|
transition-duration: 0.4s;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, PropType } from 'vue'
|
|
2
2
|
import type { HyBadgeProps } from '../hy-badge/typing'
|
|
3
|
+
import type { TabBarItem } from './typing'
|
|
3
4
|
|
|
4
5
|
const tabBarProps = {
|
|
5
6
|
/** 选中项的索引值 */
|
|
@@ -9,7 +10,7 @@ const tabBarProps = {
|
|
|
9
10
|
},
|
|
10
11
|
/** 导航栏数据集合 */
|
|
11
12
|
list: {
|
|
12
|
-
type: Array
|
|
13
|
+
type: Array as PropType<TabBarItem[]>,
|
|
13
14
|
default: () => []
|
|
14
15
|
},
|
|
15
16
|
/** 是否固定在底部 */
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/** 导航栏列表项类型 */
|
|
2
|
+
export interface TabBarItem {
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* 标题
|
|
4
5
|
* */
|
|
5
6
|
name: string
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* icon 图标或者图片
|
|
8
9
|
* */
|
|
9
10
|
icon: string
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* 徽标值
|
|
12
13
|
* */
|
|
13
14
|
badge?: number
|
|
14
15
|
}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
@include m(circle) {
|
|
20
20
|
margin-left: $hy-border-margin-padding-lg;
|
|
21
21
|
margin-right: $hy-border-margin-padding-lg;
|
|
22
|
-
border-radius: $hy-
|
|
23
|
-
box-shadow: $hy-
|
|
22
|
+
border-radius: $hy-radius-semicircle;
|
|
23
|
+
box-shadow: $hy-shadow-base;
|
|
24
24
|
|
|
25
25
|
@include is(fixed) {
|
|
26
26
|
@include is(safe) {
|