hy-app 0.3.1 → 0.3.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/README.md +6 -3
- package/common/shakeService.ts +31 -29
- package/components/hy-action-sheet/hy-action-sheet.vue +71 -46
- package/components/hy-address-picker/hy-address-picker.vue +94 -83
- package/components/hy-address-picker/index.scss +1 -1
- package/components/hy-avatar/hy-avatar.vue +87 -91
- package/components/hy-avatar/index.scss +1 -1
- package/components/hy-back-top/index.scss +1 -1
- package/components/hy-badge/hy-badge.vue +47 -46
- package/components/hy-button/hy-button.vue +117 -93
- package/components/hy-button/index.scss +2 -2
- package/components/hy-calendar/header.vue +11 -11
- package/components/hy-calendar/hy-calendar.vue +168 -160
- package/components/hy-calendar/index.scss +25 -25
- package/components/hy-calendar/month.vue +18 -19
- package/components/hy-card/hy-card.vue +55 -50
- package/components/hy-card/index.scss +11 -9
- package/components/hy-card/typing.d.ts +33 -32
- package/components/hy-cell/hy-cell.vue +81 -59
- package/components/hy-cell/index.scss +15 -15
- package/components/hy-check-button/hy-check-button.vue +54 -47
- package/components/hy-checkbox/hy-checkbox.vue +103 -111
- package/components/hy-checkbox/index.scss +24 -23
- package/components/hy-code-input/hy-code-input.vue +80 -89
- package/components/hy-config-provider/hy-config-provider.vue +19 -20
- package/components/hy-count-down/hy-count-down.vue +66 -67
- package/components/hy-count-to/hy-count-to.vue +105 -99
- package/components/hy-count-to/typing.d.ts +13 -12
- package/components/hy-datetime-picker/hy-datetime-picker.vue +261 -253
- package/components/hy-datetime-picker/typing.d.ts +42 -40
- package/components/hy-divider/hy-divider.vue +68 -73
- package/components/hy-dropdown/hy-dropdown.vue +20 -19
- package/components/hy-dropdown-item/hy-dropdown-item.vue +66 -61
- package/components/hy-dropdown-item/typing.d.ts +9 -9
- package/components/hy-empty/hy-empty.vue +53 -50
- package/components/hy-empty/icon.ts +32 -58
- package/components/hy-empty/index.scss +2 -2
- package/components/hy-empty/typing.d.ts +48 -35
- package/components/hy-flex/hy-flex.vue +52 -26
- package/components/hy-float-button/hy-float-button.vue +218 -210
- package/components/hy-folding-panel/hy-folding-panel.vue +32 -33
- package/components/hy-form/hy-form.vue +264 -259
- package/components/hy-grid/hy-grid.vue +44 -43
- package/components/hy-icon/hy-icon.vue +61 -67
- package/components/hy-image/hy-image.vue +112 -88
- package/components/hy-image/typing.d.ts +27 -23
- package/components/hy-input/hy-input.vue +157 -127
- package/components/hy-input/typing.d.ts +53 -47
- package/components/hy-line/hy-line.vue +26 -26
- package/components/hy-line-progress/hy-line-progress.vue +42 -35
- package/components/hy-list/hy-list.vue +76 -85
- package/components/hy-loading/hy-loading.vue +26 -23
- package/components/hy-menu/hy-menu.vue +48 -43
- package/components/hy-menu/typing.d.ts +18 -17
- package/components/hy-modal/hy-modal.vue +39 -35
- package/components/hy-navbar/hy-navbar.vue +25 -25
- package/components/hy-navbar/typing.d.ts +24 -22
- package/components/hy-notice-bar/hy-column-notice.vue +2 -2
- package/components/hy-notice-bar/hy-notice-bar.vue +26 -27
- package/components/hy-notice-bar/hy-row-notice.vue +1 -1
- package/components/hy-notice-bar/index.scss +6 -0
- package/components/hy-notify/hy-notify.vue +53 -53
- package/components/hy-number-step/hy-number-step.vue +134 -146
- package/components/hy-number-step/typing.d.ts +35 -35
- package/components/hy-overlay/hy-overlay.vue +23 -21
- package/components/hy-pagination/hy-pagination.vue +41 -36
- package/components/hy-picker/hy-picker.vue +184 -154
- package/components/hy-picker/typing.d.ts +39 -39
- package/components/hy-popover/hy-popover.vue +97 -77
- package/components/hy-popover/index.scss +3 -3
- package/components/hy-popup/hy-popup.vue +107 -98
- package/components/hy-price/hy-price.vue +38 -34
- package/components/hy-qrcode/hy-qrcode.vue +50 -51
- package/components/hy-radio/hy-radio.vue +101 -113
- package/components/hy-rate/hy-rate.vue +107 -88
- package/components/hy-read-more/hy-read-more.vue +64 -49
- package/components/hy-scroll-list/hy-scroll-list.vue +45 -48
- package/components/hy-search/hy-search.vue +75 -75
- package/components/hy-search/typing.d.ts +36 -35
- package/components/hy-signature/hy-signature.vue +282 -240
- package/components/hy-slider/hy-slider.vue +194 -152
- package/components/hy-slider/typing.d.ts +21 -21
- package/components/hy-steps/hy-steps.vue +118 -90
- package/components/hy-steps/index.scss +31 -21
- package/components/hy-submit-bar/hy-submit-bar.vue +61 -70
- package/components/hy-subsection/hy-subsection.vue +99 -102
- package/components/hy-subsection/typing.d.ts +19 -19
- package/components/hy-swipe-action/hy-swipe-action.vue +131 -118
- package/components/hy-swiper/hy-swiper.vue +85 -71
- package/components/hy-switch/hy-switch.vue +67 -72
- package/components/hy-switch/typing.d.ts +21 -19
- package/components/hy-tabs/hy-tabs.vue +168 -113
- package/components/hy-tag/hy-tag.vue +91 -87
- package/components/hy-tag/index.scss +13 -12
- package/components/hy-tag/typing.d.ts +26 -21
- package/components/hy-text/hy-text.vue +119 -111
- package/components/hy-textarea/hy-textarea.vue +100 -93
- package/components/hy-textarea/typing.d.ts +36 -31
- package/components/hy-toast/hy-toast.vue +77 -67
- package/components/hy-tooltip/hy-tooltip.vue +109 -91
- package/components/hy-transition/hy-transition.vue +62 -66
- package/components/hy-upload/hy-upload.vue +289 -154
- package/components/hy-upload/typing.d.ts +62 -36
- package/components/hy-warn/hy-warn.vue +34 -27
- package/components/hy-waterfall/hy-waterfall.vue +83 -74
- package/components/hy-watermark/hy-watermark.vue +134 -115
- package/composables/usePopover.ts +236 -221
- package/composables/useQueue.ts +53 -52
- package/libs/css/mixin.scss +4 -1
- package/libs/css/vars.css +2 -0
- package/package.json +2 -2
- package/store/index.ts +9 -1
- package/theme.scss +1 -0
- package/typing/index.ts +0 -1
- package/typing/modules/common.d.ts +0 -2
- package/web-types.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- 标题栏 -->
|
|
3
|
-
<view
|
|
3
|
+
<view
|
|
4
|
+
:class="['hy-dropdown-item__header', isOpen && 'is-active']"
|
|
5
|
+
@click="handleClick"
|
|
6
|
+
>
|
|
4
7
|
<text
|
|
5
8
|
class="hy-dropdown-item__header--title"
|
|
6
9
|
:style="{ color: currentColor, fontSize: addUnit(titleSize) }"
|
|
@@ -17,7 +20,11 @@
|
|
|
17
20
|
></HyIcon>
|
|
18
21
|
</view>
|
|
19
22
|
<!-- 下拉弹窗 -->
|
|
20
|
-
<HyOverlay
|
|
23
|
+
<HyOverlay
|
|
24
|
+
:show="isOpen"
|
|
25
|
+
:custom-style="{ top: addUnit(dropPopupTop) }"
|
|
26
|
+
@click="closePopupFn"
|
|
27
|
+
>
|
|
21
28
|
<view
|
|
22
29
|
class="hy-dropdown-item__main"
|
|
23
30
|
:style="{ top: addUnit(dropPopupTop), height: addUnit(dropHeight) }"
|
|
@@ -59,11 +66,11 @@
|
|
|
59
66
|
|
|
60
67
|
<script lang="ts">
|
|
61
68
|
export default {
|
|
62
|
-
name:
|
|
69
|
+
name: "hy-dropdown-item",
|
|
63
70
|
options: {
|
|
64
|
-
styleIsolation:
|
|
71
|
+
styleIsolation: "shared",
|
|
65
72
|
},
|
|
66
|
-
}
|
|
73
|
+
};
|
|
67
74
|
</script>
|
|
68
75
|
|
|
69
76
|
<script setup lang="ts">
|
|
@@ -74,24 +81,22 @@ import {
|
|
|
74
81
|
onMounted,
|
|
75
82
|
watch,
|
|
76
83
|
useSlots,
|
|
77
|
-
toRefs,
|
|
78
84
|
getCurrentInstance,
|
|
79
85
|
type PropType,
|
|
80
|
-
} from
|
|
81
|
-
import type { IDropdownItemEmits } from
|
|
82
|
-
import type FatherIProps from
|
|
83
|
-
import
|
|
84
|
-
import {
|
|
85
|
-
import { IconConfig } from '../../config'
|
|
86
|
+
} from "vue";
|
|
87
|
+
import type { IDropdownItemEmits, DropdownMenuItem } from "./typing";
|
|
88
|
+
import type FatherIProps from "../hy-dropdown/typing";
|
|
89
|
+
import { addUnit, getRect, throttle } from "../../utils";
|
|
90
|
+
import { IconConfig } from "../../config";
|
|
86
91
|
// 组件
|
|
87
|
-
import HyOverlay from
|
|
88
|
-
import HyIcon from
|
|
92
|
+
import HyOverlay from "../hy-overlay/hy-overlay.vue";
|
|
93
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
89
94
|
|
|
90
95
|
/**
|
|
91
96
|
* 主要提供筛选下拉筛选框,内置基础筛选功能,可以根据自己的需求自定义筛选项。和hy-dropdown组合用法
|
|
92
97
|
* @displayName hy-dropdown-item
|
|
93
98
|
*/
|
|
94
|
-
defineOptions({})
|
|
99
|
+
defineOptions({});
|
|
95
100
|
|
|
96
101
|
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
97
102
|
const props = defineProps({
|
|
@@ -109,69 +114,69 @@ const props = defineProps({
|
|
|
109
114
|
type: Boolean,
|
|
110
115
|
default: false,
|
|
111
116
|
},
|
|
112
|
-
})
|
|
113
|
-
const
|
|
114
|
-
const emits = defineEmits<IDropdownItemEmits>()
|
|
117
|
+
});
|
|
118
|
+
const emit = defineEmits<IDropdownItemEmits>();
|
|
115
119
|
|
|
116
|
-
const slots = useSlots()
|
|
120
|
+
const slots = useSlots();
|
|
117
121
|
//是否有插槽
|
|
118
122
|
const hasSlot = computed(() => {
|
|
119
|
-
return Object.keys(slots).length > 0
|
|
120
|
-
})
|
|
121
|
-
const instance = getCurrentInstance()
|
|
123
|
+
return Object.keys(slots).length > 0;
|
|
124
|
+
});
|
|
125
|
+
const instance = getCurrentInstance();
|
|
122
126
|
//父的props值
|
|
123
|
-
const dropdownProps: FatherIProps | undefined = inject(
|
|
124
|
-
const { titleSize, menuIcon, menuIconSize, inactiveColor } =
|
|
127
|
+
const dropdownProps: FatherIProps | undefined = inject("dropdownProps");
|
|
128
|
+
const { titleSize, menuIcon, menuIconSize, inactiveColor } =
|
|
129
|
+
dropdownProps as FatherIProps;
|
|
125
130
|
//当前打开的dropItem项(标签名)
|
|
126
|
-
const currentDropItem: any = inject(
|
|
131
|
+
const currentDropItem: any = inject("currentDropItem");
|
|
127
132
|
//当前文字/箭头颜色
|
|
128
133
|
const currentColor = computed(() => {
|
|
129
|
-
return isOpen.value ? dropdownProps?.activeColor : inactiveColor
|
|
130
|
-
})
|
|
134
|
+
return isOpen.value ? dropdownProps?.activeColor : inactiveColor;
|
|
135
|
+
});
|
|
131
136
|
//是否打开
|
|
132
|
-
const isOpen = ref<boolean>(false)
|
|
137
|
+
const isOpen = ref<boolean>(false);
|
|
133
138
|
//下拉弹窗距离页面顶部距离
|
|
134
|
-
const dropPopupTop = ref(0)
|
|
139
|
+
const dropPopupTop = ref(0);
|
|
135
140
|
//下拉弹窗高度
|
|
136
|
-
const dropHeight = ref<string | number>(0)
|
|
141
|
+
const dropHeight = ref<string | number>(0);
|
|
137
142
|
//下拉选项当前选中的索引
|
|
138
|
-
const currentIndex = ref(-1)
|
|
143
|
+
const currentIndex = ref(-1);
|
|
139
144
|
|
|
140
145
|
//动态class
|
|
141
|
-
const customClass = computed(() => (isOpen.value ?
|
|
146
|
+
const customClass = computed(() => (isOpen.value ? "visible" : "hidden"));
|
|
142
147
|
|
|
143
148
|
onMounted(() => {
|
|
144
|
-
getDropPopupTop()
|
|
145
|
-
})
|
|
149
|
+
getDropPopupTop();
|
|
150
|
+
});
|
|
146
151
|
|
|
147
152
|
/**
|
|
148
153
|
* @description 计算下拉弹窗区域距离页面顶部距离
|
|
149
154
|
* */
|
|
150
155
|
const getDropPopupTop = () => {
|
|
151
|
-
getRect(
|
|
152
|
-
const { bottom } = rect as UniApp.NodeInfo
|
|
156
|
+
getRect(".hy-dropdown-item__header", false, instance).then((rect) => {
|
|
157
|
+
const { bottom } = rect as UniApp.NodeInfo;
|
|
153
158
|
// #ifdef H5
|
|
154
159
|
//H5需要加上导航栏高度,固定44px
|
|
155
|
-
dropPopupTop.value = (bottom || 0) + 44
|
|
160
|
+
dropPopupTop.value = (bottom || 0) + 44;
|
|
156
161
|
// #endif
|
|
157
162
|
// #ifndef H5
|
|
158
|
-
dropPopupTop.value = bottom || 0
|
|
163
|
+
dropPopupTop.value = bottom || 0;
|
|
159
164
|
// #endif
|
|
160
|
-
})
|
|
161
|
-
}
|
|
165
|
+
});
|
|
166
|
+
};
|
|
162
167
|
|
|
163
168
|
watch(isOpen, (v) => {
|
|
164
169
|
//打开状态显示父容器
|
|
165
170
|
if (v) {
|
|
166
|
-
dropHeight.value =
|
|
171
|
+
dropHeight.value = "auto";
|
|
167
172
|
} else {
|
|
168
173
|
//关闭状态隐藏父容器
|
|
169
174
|
//延迟改变使得关闭动画能完整呈现
|
|
170
175
|
setTimeout(() => {
|
|
171
|
-
dropHeight.value = 0
|
|
172
|
-
}, 200)
|
|
176
|
+
dropHeight.value = 0;
|
|
177
|
+
}, 200);
|
|
173
178
|
}
|
|
174
|
-
})
|
|
179
|
+
});
|
|
175
180
|
/**
|
|
176
181
|
* @description 动态控制开关,
|
|
177
182
|
* @desc 防止点击展开后在点击下一个,导致上一个没有关闭bug
|
|
@@ -181,29 +186,29 @@ watch(
|
|
|
181
186
|
(newVal) => {
|
|
182
187
|
//关闭其他条件的下拉弹窗
|
|
183
188
|
if (newVal !== props.title) {
|
|
184
|
-
isOpen.value = false
|
|
189
|
+
isOpen.value = false;
|
|
185
190
|
}
|
|
186
191
|
},
|
|
187
|
-
)
|
|
192
|
+
);
|
|
188
193
|
|
|
189
194
|
//根据双向绑定值动态设置下拉选中项索引
|
|
190
195
|
watch(
|
|
191
|
-
() => modelValue
|
|
196
|
+
() => props.modelValue,
|
|
192
197
|
(newVal) => {
|
|
193
|
-
currentIndex.value = menus.
|
|
198
|
+
currentIndex.value = props.menus.findIndex((item) => item.value === newVal);
|
|
194
199
|
},
|
|
195
200
|
{ immediate: true },
|
|
196
|
-
)
|
|
201
|
+
);
|
|
197
202
|
|
|
198
203
|
//选中监听
|
|
199
204
|
const onSelect = (item: DropdownMenuItem, index: number) => {
|
|
200
|
-
isOpen.value = false
|
|
205
|
+
isOpen.value = false;
|
|
201
206
|
if (index !== currentIndex.value) {
|
|
202
|
-
currentIndex.value = index
|
|
203
|
-
|
|
204
|
-
|
|
207
|
+
currentIndex.value = index;
|
|
208
|
+
emit("change", item, index);
|
|
209
|
+
emit("update:modelValue", item);
|
|
205
210
|
}
|
|
206
|
-
}
|
|
211
|
+
};
|
|
207
212
|
|
|
208
213
|
/**
|
|
209
214
|
* @description 打开或关闭
|
|
@@ -211,24 +216,24 @@ const onSelect = (item: DropdownMenuItem, index: number) => {
|
|
|
211
216
|
const handleClick = () =>
|
|
212
217
|
throttle(() => {
|
|
213
218
|
//节流处理,防止点击过快动画未结束又切换导致显示bug
|
|
214
|
-
isOpen.value = !isOpen.value
|
|
219
|
+
isOpen.value = !isOpen.value;
|
|
215
220
|
if (isOpen.value) {
|
|
216
221
|
// 防止点击展开后在点击下一个,导致上一个没有关闭bug
|
|
217
|
-
currentDropItem.value = props.title
|
|
218
|
-
getDropPopupTop()
|
|
222
|
+
currentDropItem.value = props.title;
|
|
223
|
+
getDropPopupTop();
|
|
219
224
|
}
|
|
220
|
-
})
|
|
225
|
+
});
|
|
221
226
|
|
|
222
227
|
/**
|
|
223
228
|
* @description 点击遮罩框关闭弹窗
|
|
224
229
|
* */
|
|
225
230
|
const closePopupFn = () => {
|
|
226
231
|
if (dropdownProps?.closeOnClickMask) {
|
|
227
|
-
isOpen.value = false
|
|
232
|
+
isOpen.value = false;
|
|
228
233
|
}
|
|
229
|
-
}
|
|
234
|
+
};
|
|
230
235
|
</script>
|
|
231
236
|
|
|
232
237
|
<style lang="scss" scoped>
|
|
233
|
-
@import
|
|
238
|
+
@import "./index.scss";
|
|
234
239
|
</style>
|
|
@@ -2,35 +2,35 @@ export interface DropdownMenuItem {
|
|
|
2
2
|
/**
|
|
3
3
|
* @description 展示标题
|
|
4
4
|
* */
|
|
5
|
-
label: string
|
|
5
|
+
label: string;
|
|
6
6
|
/**
|
|
7
7
|
* @description 值
|
|
8
8
|
* */
|
|
9
|
-
value: string | number
|
|
9
|
+
value: string | number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export default interface HyDropdownItemProps {
|
|
13
13
|
/**
|
|
14
14
|
* @description 获取值
|
|
15
15
|
* */
|
|
16
|
-
modelValue: string | number
|
|
16
|
+
modelValue: string | number;
|
|
17
17
|
/**
|
|
18
18
|
* @description 标题
|
|
19
19
|
* */
|
|
20
|
-
title: string
|
|
20
|
+
title: string;
|
|
21
21
|
/**
|
|
22
22
|
* @description 下拉选择值
|
|
23
23
|
* */
|
|
24
|
-
menus?: DropdownMenuItem[]
|
|
24
|
+
menus?: DropdownMenuItem[];
|
|
25
25
|
/**
|
|
26
26
|
* @description 禁用组件点击
|
|
27
27
|
* */
|
|
28
|
-
disabled?: boolean
|
|
28
|
+
disabled?: boolean;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface IDropdownItemEmits {
|
|
32
32
|
/** 选中值触发 */
|
|
33
|
-
(e:
|
|
34
|
-
/**
|
|
35
|
-
(e:
|
|
33
|
+
(e: "change", item: DropdownMenuItem, index: number): void;
|
|
34
|
+
/** 值改变触发 */
|
|
35
|
+
(e: "update:modelValue", item: DropdownMenuItem): void;
|
|
36
36
|
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="['hy-empty', customClass]" v-if="show" :style="emptyStyle">
|
|
3
3
|
<view class="hy-empty__img" :style="imgStyle">
|
|
4
|
-
<
|
|
5
|
-
:
|
|
4
|
+
<HyImage
|
|
5
|
+
:src="imageUrl || emptyIcon[mode].icon"
|
|
6
6
|
:width="width"
|
|
7
7
|
:height="height"
|
|
8
8
|
img-mode="widthFix"
|
|
9
|
-
></
|
|
9
|
+
></HyImage>
|
|
10
10
|
</view>
|
|
11
11
|
<view v-if="$slots.default">
|
|
12
12
|
<slot></slot>
|
|
13
13
|
</view>
|
|
14
|
-
<view class="hy-
|
|
14
|
+
<view class="hy-empty--description" v-else>
|
|
15
15
|
<slot v-if="$slots.description" name="description"></slot>
|
|
16
|
-
<text v-else :style="descriptionStyle">{{
|
|
17
|
-
|
|
16
|
+
<text v-else :style="descriptionStyle">{{
|
|
17
|
+
emptyDescription || emptyIcon[mode].desc
|
|
18
|
+
}}</text>
|
|
19
|
+
<view class="hy-empty--button" v-if="button?.text">
|
|
18
20
|
<HyButton
|
|
19
21
|
:text="button?.text"
|
|
20
22
|
:size="button?.size"
|
|
@@ -31,32 +33,31 @@
|
|
|
31
33
|
|
|
32
34
|
<script lang="ts">
|
|
33
35
|
export default {
|
|
34
|
-
name:
|
|
36
|
+
name: "hy-empty",
|
|
35
37
|
options: {
|
|
36
38
|
addGlobalClass: true,
|
|
37
39
|
virtualHost: true,
|
|
38
|
-
styleIsolation:
|
|
40
|
+
styleIsolation: "shared",
|
|
39
41
|
},
|
|
40
|
-
}
|
|
42
|
+
};
|
|
41
43
|
</script>
|
|
42
44
|
|
|
43
45
|
<script setup lang="ts">
|
|
44
|
-
import { computed
|
|
45
|
-
import type { CSSProperties, PropType } from
|
|
46
|
-
import { addUnit } from
|
|
47
|
-
import emptyIcon from
|
|
48
|
-
import type { HyButtonProps } from
|
|
49
|
-
import type { IEmptyEmits } from
|
|
50
|
-
|
|
46
|
+
import { computed } from "vue";
|
|
47
|
+
import type { CSSProperties, PropType } from "vue";
|
|
48
|
+
import { addUnit } from "../../utils";
|
|
49
|
+
import emptyIcon from "./icon";
|
|
50
|
+
import type { HyButtonProps } from "../hy-button/typing";
|
|
51
|
+
import type { IEmptyEmits } from "./typing";
|
|
51
52
|
// 组件
|
|
52
|
-
import HyButton from
|
|
53
|
-
import
|
|
53
|
+
import HyButton from "../hy-button/hy-button.vue";
|
|
54
|
+
import HyImage from "../hy-image/hy-image.vue";
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* 加载的第一页数据就为空
|
|
57
58
|
* @displayName hy-empty
|
|
58
59
|
*/
|
|
59
|
-
defineOptions({})
|
|
60
|
+
defineOptions({});
|
|
60
61
|
|
|
61
62
|
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
62
63
|
const props = defineProps({
|
|
@@ -66,10 +67,13 @@ const props = defineProps({
|
|
|
66
67
|
default: true,
|
|
67
68
|
required: true,
|
|
68
69
|
},
|
|
69
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* 缺省页内容
|
|
72
|
+
* @values content,search,address,network,order,coupon,favor,history,message,comment,integral
|
|
73
|
+
* */
|
|
70
74
|
mode: {
|
|
71
75
|
type: String,
|
|
72
|
-
default:
|
|
76
|
+
default: "content",
|
|
73
77
|
},
|
|
74
78
|
/** 空状态图片 */
|
|
75
79
|
imageUrl: String,
|
|
@@ -80,13 +84,13 @@ const props = defineProps({
|
|
|
80
84
|
},
|
|
81
85
|
/** 组件层级 */
|
|
82
86
|
width: {
|
|
83
|
-
type: Number,
|
|
84
|
-
default:
|
|
87
|
+
type: [String, Number],
|
|
88
|
+
default: "240px",
|
|
85
89
|
},
|
|
86
90
|
/** icon高度 */
|
|
87
91
|
height: {
|
|
88
92
|
type: [String, Number],
|
|
89
|
-
default:
|
|
93
|
+
default: "240px",
|
|
90
94
|
},
|
|
91
95
|
/** 提示信息 */
|
|
92
96
|
description: String,
|
|
@@ -107,62 +111,61 @@ const props = defineProps({
|
|
|
107
111
|
/** 定义需要用到的外部样式 */
|
|
108
112
|
customStyle: {
|
|
109
113
|
type: Object as PropType<CSSProperties>,
|
|
114
|
+
default: () => {},
|
|
110
115
|
},
|
|
111
116
|
/** 自定义外部类名 */
|
|
112
117
|
customClass: String,
|
|
113
|
-
})
|
|
114
|
-
const
|
|
115
|
-
toRefs(props)
|
|
116
|
-
const emit = defineEmits<IEmptyEmits>()
|
|
118
|
+
});
|
|
119
|
+
const emit = defineEmits<IEmptyEmits>();
|
|
117
120
|
|
|
118
121
|
const emptyDescription = computed(() => {
|
|
119
|
-
return props.description
|
|
120
|
-
})
|
|
122
|
+
return props.description;
|
|
123
|
+
});
|
|
121
124
|
|
|
122
125
|
/**
|
|
123
126
|
* @description 整体样式
|
|
124
127
|
* */
|
|
125
128
|
const emptyStyle = computed<CSSProperties>(() => {
|
|
126
129
|
const style: CSSProperties = {
|
|
127
|
-
zIndex: zIndex
|
|
128
|
-
}
|
|
129
|
-
return Object.assign(style, customStyle
|
|
130
|
-
})
|
|
130
|
+
zIndex: props.zIndex,
|
|
131
|
+
};
|
|
132
|
+
return Object.assign(style, props.customStyle);
|
|
133
|
+
});
|
|
131
134
|
|
|
132
135
|
/**
|
|
133
136
|
* @description 提示信息样式
|
|
134
137
|
* */
|
|
135
138
|
const descriptionStyle = computed<CSSProperties>(() => {
|
|
136
139
|
const style: CSSProperties = {
|
|
137
|
-
fontSize: addUnit(desSize
|
|
138
|
-
color: desColor
|
|
139
|
-
}
|
|
140
|
-
return style
|
|
141
|
-
})
|
|
140
|
+
fontSize: addUnit(props.desSize),
|
|
141
|
+
color: props.desColor,
|
|
142
|
+
};
|
|
143
|
+
return style;
|
|
144
|
+
});
|
|
142
145
|
|
|
143
146
|
/**
|
|
144
147
|
* @description 图片样式
|
|
145
148
|
* */
|
|
146
149
|
const imgStyle = computed<CSSProperties>(() => {
|
|
147
150
|
return {
|
|
148
|
-
width: addUnit(width
|
|
149
|
-
height: addUnit(height
|
|
150
|
-
margin: imgMargin
|
|
151
|
-
}
|
|
152
|
-
})
|
|
151
|
+
width: addUnit(props.width),
|
|
152
|
+
height: addUnit(props.height),
|
|
153
|
+
margin: props.imgMargin,
|
|
154
|
+
};
|
|
155
|
+
});
|
|
153
156
|
|
|
154
157
|
/**
|
|
155
158
|
* @description 点击按钮,跳转页面
|
|
156
159
|
* */
|
|
157
160
|
const handleClick = () => {
|
|
158
|
-
emit(
|
|
159
|
-
if (navigateUrl
|
|
161
|
+
emit("click");
|
|
162
|
+
if (props.navigateUrl) {
|
|
160
163
|
uni.navigateTo({
|
|
161
|
-
url: navigateUrl
|
|
162
|
-
})
|
|
164
|
+
url: props.navigateUrl,
|
|
165
|
+
});
|
|
163
166
|
}
|
|
164
|
-
}
|
|
167
|
+
};
|
|
165
168
|
</script>
|
|
166
169
|
<style scoped lang="scss">
|
|
167
|
-
@import
|
|
170
|
+
@import "./index.scss";
|
|
168
171
|
</style>
|
|
@@ -1,78 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
icon:
|
|
1
|
+
import type { IEmptyIcon } from "./typing";
|
|
2
|
+
|
|
3
|
+
const url = "https://registry.npmmirror.com/wot-design-uni-assets/*/files/";
|
|
4
|
+
|
|
5
|
+
const emptyIcon: IEmptyIcon = {
|
|
6
|
+
content: {
|
|
7
|
+
desc: "暂无内容",
|
|
8
|
+
icon: url + "content.png",
|
|
9
9
|
},
|
|
10
10
|
search: {
|
|
11
|
-
|
|
12
|
-
icon:
|
|
11
|
+
desc: "没有搜索结果",
|
|
12
|
+
icon: url + "search.png",
|
|
13
13
|
},
|
|
14
14
|
address: {
|
|
15
|
-
|
|
16
|
-
icon:
|
|
15
|
+
desc: "没有收货地址",
|
|
16
|
+
icon: url + "png",
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
icon:
|
|
18
|
+
network: {
|
|
19
|
+
desc: "没有网络",
|
|
20
|
+
icon: url + "network.png",
|
|
21
21
|
},
|
|
22
22
|
order: {
|
|
23
|
-
|
|
24
|
-
icon:
|
|
23
|
+
desc: "订单为空",
|
|
24
|
+
icon: url + "png",
|
|
25
25
|
},
|
|
26
26
|
coupon: {
|
|
27
|
-
|
|
28
|
-
icon:
|
|
27
|
+
desc: "没有优惠券",
|
|
28
|
+
icon: url + "png",
|
|
29
29
|
},
|
|
30
30
|
favor: {
|
|
31
|
-
|
|
32
|
-
icon:
|
|
33
|
-
},
|
|
34
|
-
permission: {
|
|
35
|
-
name: '无权限',
|
|
36
|
-
icon: 'https://pic1.imgdb.cn/item/685a6b4358cb8da5c86b6f85.webp',
|
|
31
|
+
desc: "暂无收藏",
|
|
32
|
+
icon: url + "collect.png",
|
|
37
33
|
},
|
|
38
34
|
history: {
|
|
39
|
-
|
|
40
|
-
icon:
|
|
35
|
+
desc: "无历史记录",
|
|
36
|
+
icon: url + "png",
|
|
41
37
|
},
|
|
42
38
|
message: {
|
|
43
|
-
|
|
44
|
-
icon:
|
|
45
|
-
},
|
|
46
|
-
image: {
|
|
47
|
-
name: '暂无图片',
|
|
48
|
-
icon: 'https://pic1.imgdb.cn/item/685a6b3f58cb8da5c86b6f65.webp',
|
|
49
|
-
},
|
|
50
|
-
video: {
|
|
51
|
-
name: '暂无视频',
|
|
52
|
-
icon: 'https://pic1.imgdb.cn/item/685a6b3f58cb8da5c86b6f66.webp',
|
|
39
|
+
desc: "消息列表为空",
|
|
40
|
+
icon: url + "message.png",
|
|
53
41
|
},
|
|
54
42
|
comment: {
|
|
55
|
-
|
|
56
|
-
icon:
|
|
43
|
+
desc: "暂无评论",
|
|
44
|
+
icon: url + "comment.png",
|
|
57
45
|
},
|
|
58
46
|
integral: {
|
|
59
|
-
|
|
60
|
-
icon:
|
|
61
|
-
},
|
|
62
|
-
subscribe: {
|
|
63
|
-
name: '暂无预约',
|
|
64
|
-
icon: 'https://pic1.imgdb.cn/item/685a6b1f58cb8da5c86b6e86.webp',
|
|
65
|
-
},
|
|
66
|
-
earnings: {
|
|
67
|
-
name: '暂无收益',
|
|
68
|
-
icon: 'https://pic1.imgdb.cn/item/685a6b3558cb8da5c86b6f1c.webp',
|
|
69
|
-
},
|
|
70
|
-
announcement: {
|
|
71
|
-
name: '暂无公告',
|
|
72
|
-
icon: 'https://pic1.imgdb.cn/item/685a6b3558cb8da5c86b6f1d.webp',
|
|
73
|
-
},
|
|
74
|
-
signIn: {
|
|
75
|
-
name: '暂无打卡',
|
|
76
|
-
icon: 'https://pic1.imgdb.cn/item/685a6b1f58cb8da5c86b6e83.webp',
|
|
47
|
+
desc: "暂无积分",
|
|
48
|
+
icon: url + "halo.png",
|
|
77
49
|
},
|
|
78
|
-
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default emptyIcon;
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
background: $hy-background;
|
|
15
|
-
|
|
15
|
+
@include m(description) {
|
|
16
16
|
width: 70%;
|
|
17
17
|
text-align: center;
|
|
18
18
|
margin-top: $hy-border-margin-padding-base;
|
|
19
19
|
color: $hy-text-color--grey;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
@include m(button) {
|
|
23
23
|
margin-top: 100rpx;
|
|
24
24
|
}
|
|
25
25
|
}
|