hy-app 0.2.13 → 0.2.15
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/hy-action-sheet.vue +81 -13
- package/components/hy-action-sheet/typing.d.ts +1 -3
- package/components/hy-address-picker/hy-address-picker.vue +109 -8
- package/components/hy-address-picker/index.scss +2 -2
- package/components/hy-address-picker/typing.d.ts +39 -30
- package/components/hy-avatar/hy-avatar.vue +78 -4
- package/components/hy-avatar/typing.d.ts +21 -16
- package/components/hy-back-top/hy-back-top.vue +86 -28
- package/components/hy-back-top/typing.d.ts +17 -12
- package/components/hy-badge/hy-badge.vue +114 -43
- package/components/hy-badge/typing.d.ts +20 -15
- package/components/hy-button/HyButton.docgen.js +6 -0
- package/components/hy-button/hy-button.vue +70 -77
- package/components/hy-button/props.ts +40 -41
- package/components/hy-calendar/hy-calendar.vue +290 -143
- package/components/hy-calendar/typing.d.ts +38 -31
- package/components/hy-card/hy-card.vue +139 -36
- package/components/hy-card/typing.d.ts +39 -28
- package/components/hy-cell/hy-cell.vue +131 -67
- package/components/hy-cell/typing.d.ts +6 -1
- package/components/hy-check-button/hy-check-button.vue +101 -32
- package/components/hy-check-button/typing.d.ts +26 -19
- package/components/hy-checkbox/hy-checkbox.vue +167 -78
- package/components/hy-checkbox/typing.d.ts +26 -19
- package/components/hy-code-input/hy-code-input.vue +101 -5
- package/components/hy-code-input/typing.d.ts +9 -0
- package/components/hy-config-provider/hy-config-provider.vue +44 -24
- package/components/hy-config-provider/typing.d.ts +0 -4
- package/components/hy-count-down/hy-count-down.vue +99 -62
- package/components/hy-count-down/typing.d.ts +18 -5
- package/components/hy-count-to/hy-count-to.vue +165 -113
- package/components/hy-count-to/typing.d.ts +15 -11
- package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
- package/components/hy-datetime-picker/typing.d.ts +49 -39
- package/components/hy-divider/hy-divider.vue +128 -64
- package/components/hy-divider/typing.d.ts +16 -16
- package/components/hy-dropdown/hy-dropdown.vue +57 -19
- package/components/hy-dropdown/typing.d.ts +14 -14
- package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
- package/components/hy-dropdown-item/typing.d.ts +13 -6
- package/components/hy-empty/hy-empty.vue +64 -6
- package/components/hy-empty/typing.d.ts +5 -0
- package/components/hy-float-button/hy-float-button.vue +117 -5
- package/components/hy-float-button/typing.d.ts +7 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
- package/components/hy-folding-panel/typing.d.ts +24 -15
- package/components/hy-grid/hy-grid.vue +95 -35
- package/components/hy-grid/typing.d.ts +24 -19
- package/components/hy-icon/hy-icon.vue +84 -6
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-image/hy-image.vue +105 -6
- package/components/hy-image/typing.d.ts +9 -0
- package/components/hy-input/hy-input.vue +277 -130
- package/components/hy-input/props.ts +13 -14
- package/components/hy-input/typing.d.ts +59 -38
- package/components/hy-line/hy-line.vue +65 -25
- package/components/hy-line-progress/hy-line-progress.vue +68 -35
- package/components/hy-list/hy-list.vue +127 -61
- package/components/hy-list/typing.d.ts +19 -12
- package/components/hy-loading/hy-loading.vue +79 -25
- package/components/hy-menu/hy-menu.vue +69 -45
- package/components/hy-menu/typing.d.ts +22 -15
- package/components/hy-modal/hy-modal.vue +91 -4
- package/components/hy-modal/typing.d.ts +11 -0
- package/components/hy-navbar/hy-navbar.vue +105 -25
- package/components/hy-navbar/typing.d.ts +25 -20
- package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
- package/components/hy-notice-bar/typing.d.ts +22 -17
- package/components/hy-notify/hy-notify.vue +106 -54
- package/components/hy-number-step/hy-number-step.vue +211 -120
- package/components/hy-number-step/typing.d.ts +45 -28
- package/components/hy-overlay/hy-overlay.vue +60 -16
- package/components/hy-overlay/typing.d.ts +11 -6
- package/components/hy-pagination/hy-pagination.vue +94 -37
- package/components/hy-pagination/typing.d.ts +20 -11
- package/components/hy-picker/hy-picker.vue +225 -160
- package/components/hy-picker/typing.d.ts +51 -28
- package/components/hy-popover/hy-popover.vue +55 -7
- package/components/hy-popover/typing.d.ts +21 -1
- package/components/hy-popup/hy-popup.vue +164 -99
- package/components/hy-popup/typing.d.ts +11 -0
- package/components/hy-price/hy-price.vue +77 -30
- package/components/hy-price/typing.d.ts +10 -10
- package/components/hy-qrcode/hy-qrcode.vue +75 -5
- package/components/hy-qrcode/typing.d.ts +25 -16
- package/components/hy-radio/hy-radio.vue +169 -88
- package/components/hy-radio/typing.d.ts +29 -22
- package/components/hy-rate/hy-rate.vue +155 -104
- package/components/hy-rate/typing.d.ts +23 -16
- package/components/hy-read-more/hy-read-more.vue +83 -56
- package/components/hy-read-more/typing.d.ts +18 -11
- package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
- package/components/hy-scroll-list/typing.d.ts +14 -7
- package/components/hy-search/hy-search.vue +168 -62
- package/components/hy-search/typing.d.ts +47 -26
- package/components/hy-signature/hy-signature.vue +354 -272
- package/components/hy-signature/typing.d.ts +65 -52
- package/components/hy-slider/hy-slider.vue +208 -160
- package/components/hy-slider/typing.d.ts +28 -17
- package/components/hy-steps/hy-steps.vue +125 -99
- package/components/hy-steps/typing.d.ts +21 -14
- package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
- package/components/hy-submit-bar/typing.d.ts +30 -23
- package/components/hy-subsection/hy-subsection.vue +139 -96
- package/components/hy-subsection/typing.d.ts +23 -16
- package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
- package/components/hy-swipe-action/typing.d.ts +26 -17
- package/components/hy-swiper/hy-swiper.vue +178 -73
- package/components/hy-swiper/typing.d.ts +37 -28
- package/components/hy-switch/hy-switch.vue +107 -60
- package/components/hy-switch/typing.d.ts +25 -18
- package/components/hy-tabs/hy-tabs.vue +170 -160
- package/components/hy-tabs/typing.d.ts +36 -22
- package/components/hy-tag/hy-tag.vue +133 -58
- package/components/hy-tag/typing.d.ts +26 -18
- package/components/hy-text/hy-text.vue +106 -6
- package/components/hy-text/typing.d.ts +31 -26
- package/components/hy-textarea/hy-textarea.vue +183 -89
- package/components/hy-textarea/typing.d.ts +41 -24
- package/components/hy-tooltip/hy-tooltip.vue +145 -101
- package/components/hy-tooltip/typing.d.ts +18 -13
- package/components/hy-transition/hy-transition.vue +48 -13
- package/components/hy-transition/typing.d.ts +17 -0
- package/components/hy-upload/hy-upload.vue +113 -148
- package/components/hy-upload/typing.d.ts +71 -71
- package/components/hy-warn/hy-warn.vue +79 -36
- package/components/hy-warn/typing.d.ts +18 -11
- package/components/hy-waterfall/hy-waterfall.vue +90 -77
- package/components/hy-watermark/hy-watermark.vue +82 -5
- package/components/hy-watermark/typing.d.ts +20 -20
- package/global.d.ts +39 -59
- package/package.json +5 -13
- package/utils/inspect.ts +3 -1
- package/web-types.json +1 -1
- package/component-helper.ts +0 -177
- package/components.json +0 -3287
- package/dist/attributes.json +0 -1
- package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
- package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
- package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
- package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
- package/dist/docs/components/hy-badge/hy-badge.md +0 -13
- package/dist/docs/components/hy-button/hy-button.md +0 -61
- package/dist/docs/components/hy-calendar/header.md +0 -17
- package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
- package/dist/docs/components/hy-calendar/month.md +0 -38
- package/dist/docs/components/hy-card/hy-card.md +0 -24
- package/dist/docs/components/hy-cell/hy-cell.md +0 -26
- package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
- package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
- package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
- package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
- package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
- package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
- package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
- package/dist/docs/components/hy-divider/hy-divider.md +0 -13
- package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
- package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
- package/dist/docs/components/hy-empty/hy-empty.md +0 -20
- package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
- package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
- package/dist/docs/components/hy-form/hy-form.md +0 -29
- package/dist/docs/components/hy-grid/hy-grid.md +0 -19
- package/dist/docs/components/hy-icon/hy-icon.md +0 -13
- package/dist/docs/components/hy-image/hy-image.md +0 -22
- package/dist/docs/components/hy-input/hy-input.md +0 -29
- package/dist/docs/components/hy-line/hy-line.md +0 -7
- package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
- package/dist/docs/components/hy-list/hy-list.md +0 -25
- package/dist/docs/components/hy-loading/hy-loading.md +0 -14
- package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
- package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
- package/dist/docs/components/hy-login/hy-login.md +0 -14
- package/dist/docs/components/hy-menu/hy-menu.md +0 -21
- package/dist/docs/components/hy-modal/hy-modal.md +0 -23
- package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
- package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
- package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
- package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
- package/dist/docs/components/hy-notify/hy-notify.md +0 -23
- package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
- package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
- package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
- package/dist/docs/components/hy-parse/hy-parse.md +0 -46
- package/dist/docs/components/hy-parse/node/node.md +0 -7
- package/dist/docs/components/hy-picker/hy-picker.md +0 -32
- package/dist/docs/components/hy-popover/hy-popover.md +0 -34
- package/dist/docs/components/hy-popup/hy-popup.md +0 -22
- package/dist/docs/components/hy-price/hy-price.md +0 -13
- package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
- package/dist/docs/components/hy-radio/hy-radio.md +0 -21
- package/dist/docs/components/hy-rate/hy-rate.md +0 -14
- package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
- package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
- package/dist/docs/components/hy-search/hy-search.md +0 -27
- package/dist/docs/components/hy-signature/hy-signature.md +0 -45
- package/dist/docs/components/hy-slider/hy-slider.md +0 -24
- package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
- package/dist/docs/components/hy-steps/hy-steps.md +0 -23
- package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
- package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
- package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
- package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
- package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
- package/dist/docs/components/hy-switch/hy-switch.md +0 -20
- package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
- package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
- package/dist/docs/components/hy-tag/hy-tag.md +0 -21
- package/dist/docs/components/hy-text/hy-text.md +0 -13
- package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
- package/dist/docs/components/hy-toast/hy-toast.md +0 -17
- package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
- package/dist/docs/components/hy-transition/hy-transition.md +0 -25
- package/dist/docs/components/hy-upload/hy-upload.md +0 -25
- package/dist/docs/components/hy-warn/hy-warn.md +0 -14
- package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
- package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
- package/dist/docs/components/message/TheMessage.md +0 -17
- package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
- package/dist/tags.json +0 -1
- package/dist/web-types.json +0 -1
- package/docgen.config.js +0 -14
- package/web-types.config.js +0 -7
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="[`hy-steps--${direction}`, 'hy-steps']">
|
|
3
3
|
<template v-for="(item, i) in list" :key="i">
|
|
4
|
-
<view
|
|
5
|
-
ref="hy-steps-item"
|
|
6
|
-
:class="[`hy-steps-item--${direction}`, 'hy-steps-item']"
|
|
7
|
-
>
|
|
4
|
+
<view ref="hy-steps-item" :class="[`hy-steps-item--${direction}`, 'hy-steps-item']">
|
|
8
5
|
<!-- 线条 -->
|
|
9
6
|
<view
|
|
10
7
|
v-if="i > 0"
|
|
@@ -36,51 +33,40 @@
|
|
|
36
33
|
:style="{
|
|
37
34
|
backgroundColor: statusColor(i, item?.error),
|
|
38
35
|
}"
|
|
39
|
-
>
|
|
40
|
-
|
|
41
|
-
<view
|
|
42
|
-
class="hy-steps-item__wrapper__icon"
|
|
43
|
-
v-else-if="activeIcon || inactiveIcon"
|
|
44
|
-
>
|
|
36
|
+
></view>
|
|
37
|
+
<view class="hy-steps-item__wrapper__icon" v-else-if="activeIcon || inactiveIcon">
|
|
45
38
|
<HyIcon
|
|
46
39
|
:name="i <= current ? activeIcon : inactiveIcon"
|
|
47
40
|
:size="iconSize"
|
|
48
41
|
:color="i <= current ? activeColor : inactiveColor"
|
|
49
|
-
>
|
|
50
|
-
</HyIcon>
|
|
42
|
+
></HyIcon>
|
|
51
43
|
</view>
|
|
52
44
|
<view
|
|
53
45
|
v-else
|
|
54
46
|
:style="{
|
|
55
47
|
backgroundColor:
|
|
56
|
-
statusClass(i, item.error) === 'process'
|
|
57
|
-
? activeColor
|
|
58
|
-
: 'transparent',
|
|
48
|
+
statusClass(i, item.error) === 'process' ? activeColor : 'transparent',
|
|
59
49
|
borderColor: statusColor(i, item?.error),
|
|
60
50
|
}"
|
|
61
51
|
class="hy-steps-item__wrapper__circle"
|
|
62
52
|
>
|
|
63
53
|
<text
|
|
64
54
|
v-if="
|
|
65
|
-
statusClass(i, item.error) === 'process' ||
|
|
66
|
-
statusClass(i, item.error) === 'wait'
|
|
55
|
+
statusClass(i, item.error) === 'process' || statusClass(i, item.error) === 'wait'
|
|
67
56
|
"
|
|
68
57
|
class="hy-steps-item__wrapper__circle__text"
|
|
69
58
|
:style="{
|
|
70
59
|
color: i == current ? '#ffffff' : inactiveColor,
|
|
71
60
|
}"
|
|
72
|
-
>{{ i + 1 }}</text
|
|
73
61
|
>
|
|
62
|
+
{{ i + 1 }}
|
|
63
|
+
</text>
|
|
74
64
|
<HyIcon
|
|
75
65
|
v-else
|
|
76
|
-
:color="
|
|
77
|
-
statusClass(i, item.error) === 'error' ? 'error' : activeColor
|
|
78
|
-
"
|
|
66
|
+
:color="statusClass(i, item.error) === 'error' ? 'error' : activeColor"
|
|
79
67
|
:size="iconSize"
|
|
80
68
|
:name="
|
|
81
|
-
statusClass(i, item.error) === 'error'
|
|
82
|
-
? IconConfig.CLOSE
|
|
83
|
-
: IconConfig.CHECK_MASK
|
|
69
|
+
statusClass(i, item.error) === 'error' ? IconConfig.CLOSE : IconConfig.CHECK_MASK
|
|
84
70
|
"
|
|
85
71
|
></HyIcon>
|
|
86
72
|
</view>
|
|
@@ -97,20 +83,17 @@
|
|
|
97
83
|
<slot name="content" :record="item" :index="i">
|
|
98
84
|
<slot name="title" :title="item.title" :index="i">
|
|
99
85
|
<text
|
|
100
|
-
:class="[
|
|
101
|
-
current == i && 'hy-steps-item__content__title--active',
|
|
102
|
-
]"
|
|
86
|
+
:class="[current == i && 'hy-steps-item__content__title--active']"
|
|
103
87
|
:style="{
|
|
104
88
|
lineHeight: '20px',
|
|
105
89
|
fontSize: current == i ? '14px' : '13px',
|
|
106
90
|
}"
|
|
107
|
-
>{{ item.title }}</text
|
|
108
91
|
>
|
|
92
|
+
{{ item.title }}
|
|
93
|
+
</text>
|
|
109
94
|
</slot>
|
|
110
95
|
<slot name="desc" :desc="item.desc" :index="i">
|
|
111
|
-
<text :style="{ fontSize: '12px', color: '#999' }">{{
|
|
112
|
-
item.desc
|
|
113
|
-
}}</text>
|
|
96
|
+
<text :style="{ fontSize: '12px', color: '#999' }">{{ item.desc }}</text>
|
|
114
97
|
</slot>
|
|
115
98
|
</slot>
|
|
116
99
|
</view>
|
|
@@ -121,14 +104,19 @@
|
|
|
121
104
|
</template>
|
|
122
105
|
|
|
123
106
|
<script lang="ts">
|
|
107
|
+
/**
|
|
108
|
+
* 一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
|
|
109
|
+
* @displayName hy-steps
|
|
110
|
+
*/
|
|
111
|
+
defineOptions({})
|
|
124
112
|
export default {
|
|
125
|
-
name:
|
|
113
|
+
name: 'hy-steps',
|
|
126
114
|
options: {
|
|
127
115
|
addGlobalClass: true,
|
|
128
116
|
virtualHost: true,
|
|
129
|
-
styleIsolation:
|
|
117
|
+
styleIsolation: 'shared',
|
|
130
118
|
},
|
|
131
|
-
}
|
|
119
|
+
}
|
|
132
120
|
</script>
|
|
133
121
|
|
|
134
122
|
<script setup lang="ts">
|
|
@@ -140,122 +128,160 @@ import {
|
|
|
140
128
|
onMounted,
|
|
141
129
|
getCurrentInstance,
|
|
142
130
|
watch,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
import type
|
|
146
|
-
import type { StepListVo } from
|
|
147
|
-
import { addUnit, getRect } from
|
|
148
|
-
import { ColorConfig, IconConfig } from
|
|
131
|
+
PropType,
|
|
132
|
+
} from 'vue'
|
|
133
|
+
import type { IStepsEmits } from './typing'
|
|
134
|
+
import type { StepListVo } from './typing'
|
|
135
|
+
import { addUnit, getRect } from '../../utils'
|
|
136
|
+
import { ColorConfig, IconConfig } from '../../config'
|
|
149
137
|
|
|
150
138
|
// 组件
|
|
151
|
-
import HyIcon from
|
|
139
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
152
140
|
|
|
153
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
141
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
142
|
+
const props = defineProps({
|
|
143
|
+
/** 设置当前处于第几步 */
|
|
144
|
+
current: {
|
|
145
|
+
type: Number,
|
|
146
|
+
default: 0,
|
|
147
|
+
},
|
|
148
|
+
/** 步骤条的数据集 */
|
|
149
|
+
list: {
|
|
150
|
+
type: Array as PropType<StepListVo[]>,
|
|
151
|
+
default: [],
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* 方向
|
|
155
|
+
* @values row,column
|
|
156
|
+
* */
|
|
157
|
+
direction: {
|
|
158
|
+
type: String,
|
|
159
|
+
default: 'row',
|
|
160
|
+
},
|
|
161
|
+
/** 激活状态颜色 */
|
|
162
|
+
activeColor: String,
|
|
163
|
+
/** 未激活状态颜色 */
|
|
164
|
+
inactiveColor: String,
|
|
165
|
+
/** 激活状态的图标 */
|
|
166
|
+
activeIcon: String,
|
|
167
|
+
/** 未激活状态图标 */
|
|
168
|
+
inactiveIcon: String,
|
|
169
|
+
/** 是否显示点类型 */
|
|
170
|
+
dot: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: false,
|
|
173
|
+
},
|
|
174
|
+
/** 图标大小 */
|
|
175
|
+
iconSize: {
|
|
176
|
+
type: [String, Number],
|
|
177
|
+
default: 17,
|
|
178
|
+
},
|
|
179
|
+
})
|
|
180
|
+
const { current, list, direction, dot, inactiveColor, activeColor } = toRefs(props)
|
|
181
|
+
const emit = defineEmits<IStepsEmits>()
|
|
157
182
|
|
|
158
183
|
const size = ref<UniApp.NodeInfo>({
|
|
159
184
|
height: 0,
|
|
160
185
|
width: 0,
|
|
161
|
-
})
|
|
162
|
-
const instance = getCurrentInstance()
|
|
186
|
+
})
|
|
187
|
+
const instance = getCurrentInstance()
|
|
163
188
|
|
|
164
189
|
watch(
|
|
165
190
|
() => current.value,
|
|
166
191
|
(newVal: number) => {
|
|
167
192
|
if (list.value[newVal - 1]?.error) {
|
|
168
|
-
const index = list.value.findIndex((item) => item.error)
|
|
169
|
-
emit(
|
|
193
|
+
const index = list.value.findIndex((item) => item.error)
|
|
194
|
+
emit('update:current', index)
|
|
195
|
+
emit('change', index)
|
|
170
196
|
}
|
|
171
197
|
},
|
|
172
|
-
)
|
|
198
|
+
)
|
|
173
199
|
|
|
174
200
|
/**
|
|
175
201
|
* @description 线条样式
|
|
176
202
|
* */
|
|
177
203
|
const lineStyle = computed(() => {
|
|
178
204
|
return (temp: StepListVo, index: number): CSSProperties => {
|
|
179
|
-
const style: CSSProperties = {}
|
|
180
|
-
if (direction.value ===
|
|
181
|
-
style.width = addUnit(size.value.width! - 25)
|
|
182
|
-
style.left = addUnit(-size.value.width! / 2 + 12)
|
|
205
|
+
const style: CSSProperties = {}
|
|
206
|
+
if (direction.value === 'row') {
|
|
207
|
+
style.width = addUnit(size.value.width! - 25)
|
|
208
|
+
style.left = addUnit(-size.value.width! / 2 + 12)
|
|
183
209
|
} else {
|
|
184
|
-
style.height = addUnit(size.value.height! - 30)
|
|
185
|
-
style.top = addUnit(25)
|
|
210
|
+
style.height = addUnit(size.value.height! - 30)
|
|
211
|
+
style.top = addUnit(25)
|
|
186
212
|
}
|
|
187
213
|
style.backgroundColor = temp.error
|
|
188
|
-
?
|
|
214
|
+
? ''
|
|
189
215
|
: index < current.value
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return style
|
|
193
|
-
}
|
|
194
|
-
})
|
|
216
|
+
? activeColor.value
|
|
217
|
+
: inactiveColor.value
|
|
218
|
+
return style
|
|
219
|
+
}
|
|
220
|
+
})
|
|
195
221
|
|
|
196
222
|
const itemStyleInner = computed(() => {
|
|
197
|
-
return {}
|
|
198
|
-
})
|
|
223
|
+
return {}
|
|
224
|
+
})
|
|
199
225
|
/**
|
|
200
226
|
* @description 状态类名
|
|
201
227
|
* */
|
|
202
228
|
const statusClass = computed(() => {
|
|
203
229
|
return (index: number, error: boolean = false) => {
|
|
204
230
|
if (current.value == index) {
|
|
205
|
-
return error ?
|
|
231
|
+
return error ? 'error' : 'process'
|
|
206
232
|
} else if (current.value > index) {
|
|
207
|
-
return
|
|
233
|
+
return 'finish'
|
|
208
234
|
} else {
|
|
209
|
-
return
|
|
235
|
+
return 'wait'
|
|
210
236
|
}
|
|
211
|
-
}
|
|
212
|
-
})
|
|
237
|
+
}
|
|
238
|
+
})
|
|
213
239
|
const statusColor = computed(() => {
|
|
214
240
|
return (index: number, error?: boolean) => {
|
|
215
|
-
let colorTmp =
|
|
241
|
+
let colorTmp = ''
|
|
216
242
|
switch (statusClass.value(index, error)) {
|
|
217
|
-
case
|
|
218
|
-
colorTmp = activeColor.value
|
|
219
|
-
break
|
|
220
|
-
case
|
|
221
|
-
colorTmp = ColorConfig.error
|
|
222
|
-
break
|
|
223
|
-
case
|
|
224
|
-
colorTmp = dot.value ? activeColor.value :
|
|
225
|
-
break
|
|
243
|
+
case 'finish':
|
|
244
|
+
colorTmp = activeColor.value
|
|
245
|
+
break
|
|
246
|
+
case 'error':
|
|
247
|
+
colorTmp = ColorConfig.error
|
|
248
|
+
break
|
|
249
|
+
case 'process':
|
|
250
|
+
colorTmp = dot.value ? activeColor.value : 'transparent'
|
|
251
|
+
break
|
|
226
252
|
default:
|
|
227
|
-
colorTmp = inactiveColor.value
|
|
228
|
-
break
|
|
253
|
+
colorTmp = inactiveColor.value
|
|
254
|
+
break
|
|
229
255
|
}
|
|
230
|
-
return colorTmp
|
|
231
|
-
}
|
|
232
|
-
})
|
|
256
|
+
return colorTmp
|
|
257
|
+
}
|
|
258
|
+
})
|
|
233
259
|
|
|
234
260
|
const contentStyle = computed<CSSProperties>(() => {
|
|
235
|
-
const style: CSSProperties = {}
|
|
236
|
-
if (direction.value ===
|
|
237
|
-
style.marginLeft = dot.value ?
|
|
238
|
-
style.marginTop = dot.value ?
|
|
261
|
+
const style: CSSProperties = {}
|
|
262
|
+
if (direction.value === 'column') {
|
|
263
|
+
style.marginLeft = dot.value ? '2px' : '6px'
|
|
264
|
+
style.marginTop = dot.value ? '0px' : '6px'
|
|
239
265
|
} else {
|
|
240
|
-
style.marginTop = dot.value ?
|
|
241
|
-
style.marginLeft = dot.value ?
|
|
266
|
+
style.marginTop = dot.value ? '2px' : '6px'
|
|
267
|
+
style.marginLeft = dot.value ? '2px' : '6px'
|
|
242
268
|
}
|
|
243
269
|
|
|
244
|
-
return style
|
|
245
|
-
})
|
|
270
|
+
return style
|
|
271
|
+
})
|
|
246
272
|
|
|
247
273
|
onMounted(() => {
|
|
248
|
-
getStepsItemRect()
|
|
249
|
-
})
|
|
274
|
+
getStepsItemRect()
|
|
275
|
+
})
|
|
250
276
|
|
|
251
277
|
// 获取组件的尺寸,用于设置横线的位置
|
|
252
278
|
const getStepsItemRect = () => {
|
|
253
|
-
getRect(
|
|
254
|
-
size.value = rect as UniApp.NodeInfo
|
|
255
|
-
})
|
|
256
|
-
}
|
|
279
|
+
getRect('.hy-steps-item', false, instance).then((rect) => {
|
|
280
|
+
size.value = rect as UniApp.NodeInfo
|
|
281
|
+
})
|
|
282
|
+
}
|
|
257
283
|
</script>
|
|
258
284
|
|
|
259
285
|
<style lang="scss" scoped>
|
|
260
|
-
@import
|
|
286
|
+
@import './index.scss';
|
|
261
287
|
</style>
|
|
@@ -1,58 +1,65 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
2
|
|
|
3
3
|
export interface StepListVo {
|
|
4
4
|
/**
|
|
5
5
|
* @description 标题
|
|
6
6
|
* */
|
|
7
|
-
title?: string
|
|
7
|
+
title?: string
|
|
8
8
|
/**
|
|
9
9
|
* @description 描述
|
|
10
10
|
* */
|
|
11
|
-
desc?: string
|
|
11
|
+
desc?: string
|
|
12
12
|
/**
|
|
13
13
|
* @description 是否错误
|
|
14
14
|
* */
|
|
15
|
-
error?: boolean
|
|
15
|
+
error?: boolean
|
|
16
16
|
}
|
|
17
17
|
export default interface HyStepsProps {
|
|
18
18
|
/**
|
|
19
19
|
* @description 设置当前处于第几步 (默认 0 )
|
|
20
20
|
* */
|
|
21
|
-
current: number
|
|
21
|
+
current: number
|
|
22
22
|
/**
|
|
23
23
|
* @description 步骤条的数据集
|
|
24
24
|
* */
|
|
25
|
-
list: StepListVo[]
|
|
25
|
+
list: StepListVo[]
|
|
26
26
|
/**
|
|
27
27
|
* @description row-横向,column-竖向 (默认 'row' )
|
|
28
28
|
* */
|
|
29
|
-
direction?: HyApp.DirectionType
|
|
29
|
+
direction?: HyApp.DirectionType
|
|
30
30
|
/**
|
|
31
31
|
* @description 激活状态颜色 (默认 '#3c9cff' )
|
|
32
32
|
* */
|
|
33
|
-
activeColor?: string
|
|
33
|
+
activeColor?: string
|
|
34
34
|
/**
|
|
35
35
|
* @description 未激活状态颜色 (默认 '#969799' )
|
|
36
36
|
* */
|
|
37
|
-
inactiveColor?: string
|
|
37
|
+
inactiveColor?: string
|
|
38
38
|
/**
|
|
39
39
|
* @description 激活状态的图标
|
|
40
40
|
* */
|
|
41
|
-
activeIcon?: string
|
|
41
|
+
activeIcon?: string
|
|
42
42
|
/**
|
|
43
43
|
* @description 未激活状态图标
|
|
44
44
|
* */
|
|
45
|
-
inactiveIcon?: string
|
|
45
|
+
inactiveIcon?: string
|
|
46
46
|
/**
|
|
47
47
|
* @description 是否显示点类型 (默认 false )
|
|
48
48
|
* */
|
|
49
|
-
dot?: boolean
|
|
49
|
+
dot?: boolean
|
|
50
50
|
/**
|
|
51
51
|
* @description 图标大小 (默认 17 )
|
|
52
52
|
* */
|
|
53
|
-
iconSize?: string | number
|
|
53
|
+
iconSize?: string | number
|
|
54
54
|
/**
|
|
55
55
|
* @description 定义需要用到的外部样式
|
|
56
56
|
* */
|
|
57
|
-
customStyle?: CSSProperties
|
|
57
|
+
customStyle?: CSSProperties
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface IStepsEmits {
|
|
61
|
+
/** 值改成触发 */
|
|
62
|
+
(e: 'change', index: number): void
|
|
63
|
+
/** 值改成触发 */
|
|
64
|
+
(e: 'update:current', index: number): void
|
|
58
65
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
3
|
-
:class="['hy-submit-bar', border && 'hy-border__top']"
|
|
4
|
-
:style="submitBarStyle"
|
|
5
|
-
>
|
|
2
|
+
<view :class="['hy-submit-bar', border && 'hy-border__top', customClass]" :style="submitBarStyle">
|
|
6
3
|
<view class="hy-submit-bar__left">
|
|
7
4
|
<slot name="left">
|
|
8
5
|
<view
|
|
@@ -70,28 +67,113 @@
|
|
|
70
67
|
</template>
|
|
71
68
|
|
|
72
69
|
<script lang="ts">
|
|
70
|
+
/**
|
|
71
|
+
* 该布局一般用于商品详情页底部引导用户快速购买商品的场景,开发者可以根据自己的需求修改布局结构和样式。
|
|
72
|
+
* @displayName hy-submit-bar
|
|
73
|
+
*/
|
|
74
|
+
defineOptions({})
|
|
73
75
|
export default {
|
|
74
|
-
name:
|
|
76
|
+
name: 'hy-submit-bar',
|
|
75
77
|
options: {
|
|
76
78
|
addGlobalClass: true,
|
|
77
79
|
virtualHost: true,
|
|
78
|
-
styleIsolation:
|
|
80
|
+
styleIsolation: 'shared',
|
|
79
81
|
},
|
|
80
|
-
}
|
|
82
|
+
}
|
|
81
83
|
</script>
|
|
82
84
|
|
|
83
85
|
<script setup lang="ts">
|
|
84
|
-
import
|
|
85
|
-
import
|
|
86
|
-
import {
|
|
87
|
-
import { debounce } from
|
|
86
|
+
import { computed, toRefs } from 'vue'
|
|
87
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
88
|
+
import type { IconMenus, ISubmitBarEmits } from './typing'
|
|
89
|
+
import { debounce } from '../../utils'
|
|
88
90
|
|
|
89
91
|
// 组件
|
|
90
|
-
import HyIcon from
|
|
91
|
-
import HyLoading from
|
|
92
|
-
import HyBadge from
|
|
92
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
93
|
+
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
94
|
+
import HyBadge from '../hy-badge/hy-badge.vue'
|
|
93
95
|
|
|
94
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
96
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
97
|
+
const props = defineProps({
|
|
98
|
+
/** 左边菜单栏 */
|
|
99
|
+
menus: {
|
|
100
|
+
type: Array as unknown as PropType<IconMenus[]>,
|
|
101
|
+
default: [],
|
|
102
|
+
},
|
|
103
|
+
/** 绝对定位 */
|
|
104
|
+
fixed: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: true,
|
|
107
|
+
},
|
|
108
|
+
/** 是否显示边框 */
|
|
109
|
+
border: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: true,
|
|
112
|
+
},
|
|
113
|
+
/** 加载左边按钮loading */
|
|
114
|
+
leftLoading: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false,
|
|
117
|
+
},
|
|
118
|
+
/** 加载右边按钮loading */
|
|
119
|
+
rightLoading: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: false,
|
|
122
|
+
},
|
|
123
|
+
/** 左边icon的颜色 */
|
|
124
|
+
iconColor: String,
|
|
125
|
+
/** 左边文字的颜色 */
|
|
126
|
+
iconLabelColor: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: '#909193FF',
|
|
129
|
+
},
|
|
130
|
+
/** 右边按钮文字颜色 */
|
|
131
|
+
textColor: String,
|
|
132
|
+
/** 显示左边按钮 */
|
|
133
|
+
showLeftBtn: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: true,
|
|
136
|
+
},
|
|
137
|
+
/** 显示右边按钮 */
|
|
138
|
+
showRightBtn: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: true,
|
|
141
|
+
},
|
|
142
|
+
/** 左边按钮文字 */
|
|
143
|
+
leftBtnText: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: '加入购物车',
|
|
146
|
+
},
|
|
147
|
+
/** 右边按钮文字 */
|
|
148
|
+
rightBtnText: {
|
|
149
|
+
type: String,
|
|
150
|
+
default: '立即购买',
|
|
151
|
+
},
|
|
152
|
+
/** 左边按钮颜色,支持渐变色 */
|
|
153
|
+
leftBtnColor: {
|
|
154
|
+
type: String,
|
|
155
|
+
default: '#ed3f14',
|
|
156
|
+
},
|
|
157
|
+
/** 有边按钮颜色,支持渐变色 */
|
|
158
|
+
rightBtnColor: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: '#ff7900',
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* 按钮的形状
|
|
164
|
+
* @values circle,square
|
|
165
|
+
* */
|
|
166
|
+
shape: {
|
|
167
|
+
type: String,
|
|
168
|
+
default: 'circle',
|
|
169
|
+
},
|
|
170
|
+
/** 定义需要用到的外部样式 */
|
|
171
|
+
customStyle: {
|
|
172
|
+
type: Object as PropType<CSSProperties>,
|
|
173
|
+
},
|
|
174
|
+
/** 自定义外部类名 */
|
|
175
|
+
customClass: String,
|
|
176
|
+
})
|
|
95
177
|
const {
|
|
96
178
|
fixed,
|
|
97
179
|
showLeftBtn,
|
|
@@ -102,10 +184,9 @@ const {
|
|
|
102
184
|
textColor,
|
|
103
185
|
leftLoading,
|
|
104
186
|
rightLoading,
|
|
105
|
-
warn,
|
|
106
187
|
customStyle,
|
|
107
|
-
} = toRefs(props)
|
|
108
|
-
const emit = defineEmits(
|
|
188
|
+
} = toRefs(props)
|
|
189
|
+
const emit = defineEmits<ISubmitBarEmits>()
|
|
109
190
|
|
|
110
191
|
/**
|
|
111
192
|
* @description 整体样式
|
|
@@ -114,10 +195,10 @@ const submitBarStyle = computed(() => {
|
|
|
114
195
|
const style: CSSProperties = {
|
|
115
196
|
bottom: 0,
|
|
116
197
|
left: 0,
|
|
117
|
-
}
|
|
118
|
-
if (fixed.value) style.position =
|
|
119
|
-
return Object.assign(style, customStyle.value)
|
|
120
|
-
})
|
|
198
|
+
}
|
|
199
|
+
if (fixed.value) style.position = 'fixed'
|
|
200
|
+
return Object.assign(style, customStyle.value)
|
|
201
|
+
})
|
|
121
202
|
|
|
122
203
|
/**
|
|
123
204
|
* @description 左边按钮样式
|
|
@@ -126,23 +207,23 @@ const leftBtnStyle = computed(() => {
|
|
|
126
207
|
const style: CSSProperties = {
|
|
127
208
|
background: leftBtnColor.value,
|
|
128
209
|
color: textColor.value,
|
|
129
|
-
}
|
|
210
|
+
}
|
|
130
211
|
if (!showRightBtn.value) {
|
|
131
|
-
style.flex = 1
|
|
132
|
-
if (shape.value ===
|
|
133
|
-
style.borderRadius =
|
|
212
|
+
style.flex = 1
|
|
213
|
+
if (shape.value === 'circle') {
|
|
214
|
+
style.borderRadius = '100px'
|
|
134
215
|
} else {
|
|
135
|
-
style.borderRadius =
|
|
216
|
+
style.borderRadius = '2px'
|
|
136
217
|
}
|
|
137
218
|
} else {
|
|
138
|
-
if (shape.value ===
|
|
139
|
-
style.borderRadius =
|
|
219
|
+
if (shape.value === 'circle') {
|
|
220
|
+
style.borderRadius = '100px 0 0 100px'
|
|
140
221
|
} else {
|
|
141
|
-
style.borderRadius =
|
|
222
|
+
style.borderRadius = '2px 0 0 2px'
|
|
142
223
|
}
|
|
143
224
|
}
|
|
144
|
-
return style
|
|
145
|
-
})
|
|
225
|
+
return style
|
|
226
|
+
})
|
|
146
227
|
|
|
147
228
|
/**
|
|
148
229
|
* @description 右边按钮样式
|
|
@@ -151,45 +232,45 @@ const rightBtnStyle = computed(() => {
|
|
|
151
232
|
const style: CSSProperties = {
|
|
152
233
|
background: rightBtnColor.value,
|
|
153
234
|
color: textColor.value,
|
|
154
|
-
}
|
|
235
|
+
}
|
|
155
236
|
if (!showLeftBtn.value) {
|
|
156
|
-
style.flex = 1
|
|
157
|
-
if (shape.value ===
|
|
158
|
-
style.borderRadius =
|
|
237
|
+
style.flex = 1
|
|
238
|
+
if (shape.value === 'circle') {
|
|
239
|
+
style.borderRadius = '100px'
|
|
159
240
|
} else {
|
|
160
|
-
style.borderRadius =
|
|
241
|
+
style.borderRadius = '2px'
|
|
161
242
|
}
|
|
162
243
|
} else {
|
|
163
|
-
if (shape.value ===
|
|
164
|
-
style.borderRadius =
|
|
244
|
+
if (shape.value === 'circle') {
|
|
245
|
+
style.borderRadius = '0 100px 100px 0'
|
|
165
246
|
} else {
|
|
166
|
-
style.borderRadius =
|
|
247
|
+
style.borderRadius = '0 2px 2px 0'
|
|
167
248
|
}
|
|
168
249
|
}
|
|
169
|
-
return style
|
|
170
|
-
})
|
|
250
|
+
return style
|
|
251
|
+
})
|
|
171
252
|
|
|
172
253
|
/**
|
|
173
254
|
* @description 点击左边图标
|
|
174
255
|
* */
|
|
175
256
|
const clickMenuFn = (i: number) => {
|
|
176
|
-
emit(
|
|
177
|
-
}
|
|
257
|
+
emit('menuClick', i)
|
|
258
|
+
}
|
|
178
259
|
|
|
179
260
|
/**
|
|
180
261
|
* @description 点击按钮
|
|
181
262
|
* */
|
|
182
|
-
const confirmClickFn =
|
|
263
|
+
const confirmClickFn = (i: number) => {
|
|
183
264
|
if (
|
|
184
265
|
(!leftLoading.value && !rightLoading.value) ||
|
|
185
266
|
(leftLoading.value && i !== 0) ||
|
|
186
267
|
(rightLoading.value && i !== 1)
|
|
187
268
|
) {
|
|
188
|
-
emit(
|
|
269
|
+
emit('click', i)
|
|
189
270
|
}
|
|
190
|
-
}
|
|
271
|
+
}
|
|
191
272
|
</script>
|
|
192
273
|
|
|
193
274
|
<style lang="scss" scoped>
|
|
194
|
-
@import
|
|
275
|
+
@import './index.scss';
|
|
195
276
|
</style>
|