uniapp-dyckui 4.1.1
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/LICENSE +21 -0
- package/README.md +104 -0
- package/dist/assets/style.BFlsbpSj.css +1472 -0
- package/dist/index.cjs.js +1380 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +1380 -0
- package/dist/index.es.js.map +1 -0
- package/dist/src/components/MyComs/Button/index.d.ts +3 -0
- package/dist/src/components/MyComs/Button/index.vue.d.ts +93 -0
- package/dist/src/components/MyComs/Dialog/index.d.ts +3 -0
- package/dist/src/components/MyComs/Dialog/index.vue.d.ts +65 -0
- package/dist/src/components/MyComs/Divider/index.d.ts +3 -0
- package/dist/src/components/MyComs/Divider/index.vue.d.ts +53 -0
- package/dist/src/components/MyComs/DropdownSelect/dropdownSelect.d.ts +10 -0
- package/dist/src/components/MyComs/DropdownSelect/index.d.ts +4 -0
- package/dist/src/components/MyComs/DropdownSelect/index.vue.d.ts +26 -0
- package/dist/src/components/MyComs/DropdownSelect/type.d.ts +13 -0
- package/dist/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.d.ts +5 -0
- package/dist/src/components/MyComs/DropdownWithBadge/index.d.ts +4 -0
- package/dist/src/components/MyComs/DropdownWithBadge/index.vue.d.ts +26 -0
- package/dist/src/components/MyComs/DropdownWithBadge/type.d.ts +9 -0
- package/dist/src/components/MyComs/FilterDrawer/hasBadge.d.ts +8 -0
- package/dist/src/components/MyComs/FilterDrawer/index.d.ts +5 -0
- package/dist/src/components/MyComs/FilterDrawer/index.vue.d.ts +26 -0
- package/dist/src/components/MyComs/FilterDrawer/type.d.ts +8 -0
- package/dist/src/components/MyComs/FilterDrawer/useFilterDrawer.d.ts +10 -0
- package/dist/src/components/MyComs/InfiniteScroll/index.d.ts +3 -0
- package/dist/src/components/MyComs/InfiniteScroll/index.vue.d.ts +65 -0
- package/dist/src/components/MyComs/Popup/index.d.ts +3 -0
- package/dist/src/components/MyComs/Popup/index.vue.d.ts +119 -0
- package/dist/src/components/MyComs/PullRefresh/index.d.ts +3 -0
- package/dist/src/components/MyComs/PullRefresh/index.vue.d.ts +117 -0
- package/dist/src/components/MyComs/Swiper/index.d.ts +3 -0
- package/dist/src/components/MyComs/Swiper/index.vue.d.ts +79 -0
- package/dist/src/components/MyComs/Toast/index.d.ts +3 -0
- package/dist/src/components/MyComs/Toast/index.vue.d.ts +108 -0
- package/dist/src/components/MyComs/index.d.ts +20 -0
- package/package.json +218 -0
- package/src/components/MyComs/Button/README.md +235 -0
- package/src/components/MyComs/Button/index.ts +3 -0
- package/src/components/MyComs/Button/index.vue +413 -0
- package/src/components/MyComs/Dialog/README.md +160 -0
- package/src/components/MyComs/Dialog/index.ts +2 -0
- package/src/components/MyComs/Dialog/index.vue +275 -0
- package/src/components/MyComs/Divider/README.md +0 -0
- package/src/components/MyComs/Divider/index.ts +2 -0
- package/src/components/MyComs/Divider/index.vue +106 -0
- package/src/components/MyComs/DropdownSelect/README.md +112 -0
- package/src/components/MyComs/DropdownSelect/dropdownSelect.less +75 -0
- package/src/components/MyComs/DropdownSelect/dropdownSelect.ts +59 -0
- package/src/components/MyComs/DropdownSelect/index.ts +4 -0
- package/src/components/MyComs/DropdownSelect/index.vue +88 -0
- package/src/components/MyComs/DropdownSelect/type.ts +15 -0
- package/src/components/MyComs/DropdownWithBadge/README.md +77 -0
- package/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.less +11 -0
- package/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.ts +10 -0
- package/src/components/MyComs/DropdownWithBadge/index.ts +4 -0
- package/src/components/MyComs/DropdownWithBadge/index.vue +39 -0
- package/src/components/MyComs/DropdownWithBadge/type.ts +12 -0
- package/src/components/MyComs/FilterDrawer/filterDrawer.less +117 -0
- package/src/components/MyComs/FilterDrawer/hasBadge.ts +41 -0
- package/src/components/MyComs/FilterDrawer/index.ts +5 -0
- package/src/components/MyComs/FilterDrawer/index.vue +53 -0
- package/src/components/MyComs/FilterDrawer/type.ts +9 -0
- package/src/components/MyComs/FilterDrawer/useFilterDrawer.ts +38 -0
- package/src/components/MyComs/InfiniteScroll/index.ts +2 -0
- package/src/components/MyComs/InfiniteScroll/index.vue +171 -0
- package/src/components/MyComs/Popup/README.md +684 -0
- package/src/components/MyComs/Popup/index.ts +2 -0
- package/src/components/MyComs/Popup/index.vue +835 -0
- package/src/components/MyComs/PullRefresh/README.md +600 -0
- package/src/components/MyComs/PullRefresh/index.ts +2 -0
- package/src/components/MyComs/PullRefresh/index.vue +599 -0
- package/src/components/MyComs/Swiper/README.md +202 -0
- package/src/components/MyComs/Swiper/index.ts +2 -0
- package/src/components/MyComs/Swiper/index.vue +245 -0
- package/src/components/MyComs/Toast/README.md +604 -0
- package/src/components/MyComs/Toast/index.ts +2 -0
- package/src/components/MyComs/Toast/index.vue +372 -0
- package/src/components/MyComs/index.ts +33 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1380 @@
|
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, normalizeClass, createCommentVNode, Fragment, renderSlot, pushScopeId, popScopeId, createElementVNode, useCssVars, ref, watch, withModifiers, toDisplayString, onMounted, onUnmounted, withDirectives, normalizeStyle, vShow, computed, renderList, nextTick, unref, createTextVNode, resolveComponent, createBlock, normalizeProps, guardReactiveProps, mergeProps, toHandlers, withCtx, isRef } from "vue";
|
|
2
|
+
const _withScopeId$4 = (n) => (pushScopeId("data-v-02c23a30"), n = n(), popScopeId(), n);
|
|
3
|
+
const _hoisted_1$a = ["disabled"];
|
|
4
|
+
const _hoisted_2$9 = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "sw-button__loading"
|
|
7
|
+
};
|
|
8
|
+
const _hoisted_3$9 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createElementVNode("text", { class: "loading-spinner" }, null, -1));
|
|
9
|
+
const _hoisted_4$7 = [
|
|
10
|
+
_hoisted_3$9
|
|
11
|
+
];
|
|
12
|
+
const _hoisted_5$5 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "sw-button__icon"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_6$5 = {
|
|
17
|
+
key: 2,
|
|
18
|
+
class: "sw-button__text"
|
|
19
|
+
};
|
|
20
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
21
|
+
__name: "index",
|
|
22
|
+
props: {
|
|
23
|
+
type: { default: "primary" },
|
|
24
|
+
size: { default: "normal" },
|
|
25
|
+
shape: { default: "default" },
|
|
26
|
+
disabled: { type: Boolean, default: false },
|
|
27
|
+
loading: { type: Boolean, default: false },
|
|
28
|
+
block: { type: Boolean, default: false },
|
|
29
|
+
round: { type: Boolean, default: false },
|
|
30
|
+
plain: { type: Boolean, default: false },
|
|
31
|
+
outline: { type: Boolean, default: false },
|
|
32
|
+
link: { type: Boolean, default: false },
|
|
33
|
+
icon: { default: "" },
|
|
34
|
+
customClass: { default: "" },
|
|
35
|
+
customStyle: { default: () => ({}) }
|
|
36
|
+
},
|
|
37
|
+
emits: ["click"],
|
|
38
|
+
setup(__props, { emit: __emit }) {
|
|
39
|
+
const props = __props;
|
|
40
|
+
const emit = __emit;
|
|
41
|
+
function handleClick(event) {
|
|
42
|
+
if (!props.disabled && !props.loading) {
|
|
43
|
+
emit("click", event);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return (_ctx, _cache) => {
|
|
47
|
+
return openBlock(), createElementBlock("view", {
|
|
48
|
+
class: normalizeClass(["sw-button", [
|
|
49
|
+
`sw-button--${_ctx.type}`,
|
|
50
|
+
`sw-button--${_ctx.size}`,
|
|
51
|
+
`sw-button--${_ctx.shape}`,
|
|
52
|
+
{ "is-disabled": _ctx.disabled },
|
|
53
|
+
{ "is-loading": _ctx.loading },
|
|
54
|
+
{ "is-block": _ctx.block },
|
|
55
|
+
{ "is-round": _ctx.round },
|
|
56
|
+
{ "is-plain": _ctx.plain },
|
|
57
|
+
{ "is-outline": _ctx.outline },
|
|
58
|
+
{ "is-link": _ctx.link }
|
|
59
|
+
]]),
|
|
60
|
+
disabled: _ctx.disabled || _ctx.loading,
|
|
61
|
+
onClick: handleClick
|
|
62
|
+
}, [
|
|
63
|
+
_ctx.loading ? (openBlock(), createElementBlock("view", _hoisted_2$9, _hoisted_4$7)) : createCommentVNode("", true),
|
|
64
|
+
!_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
65
|
+
_ctx.$slots.icon ? (openBlock(), createElementBlock("view", _hoisted_5$5, [
|
|
66
|
+
renderSlot(_ctx.$slots, "icon", {}, void 0, true)
|
|
67
|
+
])) : createCommentVNode("", true),
|
|
68
|
+
_ctx.icon ? (openBlock(), createElementBlock("text", {
|
|
69
|
+
key: 1,
|
|
70
|
+
class: normalizeClass(["sw-button__icon", [_ctx.icon]])
|
|
71
|
+
}, null, 2)) : createCommentVNode("", true)
|
|
72
|
+
], 64)) : createCommentVNode("", true),
|
|
73
|
+
_ctx.$slots.default ? (openBlock(), createElementBlock("text", _hoisted_6$5, [
|
|
74
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
75
|
+
])) : createCommentVNode("", true)
|
|
76
|
+
], 10, _hoisted_1$a);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const _export_sfc = (sfc, props) => {
|
|
81
|
+
const target = sfc.__vccOpts || sfc;
|
|
82
|
+
for (const [key, val] of props) {
|
|
83
|
+
target[key] = val;
|
|
84
|
+
}
|
|
85
|
+
return target;
|
|
86
|
+
};
|
|
87
|
+
const index$7 = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-02c23a30"]]);
|
|
88
|
+
const _withScopeId$3 = (n) => (pushScopeId("data-v-a2785685"), n = n(), popScopeId(), n);
|
|
89
|
+
const _hoisted_1$9 = { class: "dialog-content" };
|
|
90
|
+
const _hoisted_2$8 = { class: "dialog-icon" };
|
|
91
|
+
const _hoisted_3$8 = ["src"];
|
|
92
|
+
const _hoisted_4$6 = {
|
|
93
|
+
key: 1,
|
|
94
|
+
class: "default-icon"
|
|
95
|
+
};
|
|
96
|
+
const _hoisted_5$4 = { class: "dialog-title" };
|
|
97
|
+
const _hoisted_6$4 = { class: "dialog-description" };
|
|
98
|
+
const _hoisted_7$4 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("view", { class: "dialog-divider" }, null, -1));
|
|
99
|
+
const _hoisted_8$4 = { class: "dialog-buttons" };
|
|
100
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
101
|
+
__name: "index",
|
|
102
|
+
props: {
|
|
103
|
+
modelValue: { type: Boolean, default: false },
|
|
104
|
+
type: { default: "confirm" },
|
|
105
|
+
title: { default: "" },
|
|
106
|
+
description: { default: "" },
|
|
107
|
+
icon: { default: "" },
|
|
108
|
+
mask: { type: Boolean, default: true },
|
|
109
|
+
maskOpacity: { default: 0.5 },
|
|
110
|
+
closeOnMaskClick: { type: Boolean, default: true }
|
|
111
|
+
},
|
|
112
|
+
emits: ["update:modelValue", "confirm", "cancel"],
|
|
113
|
+
setup(__props, { emit: __emit }) {
|
|
114
|
+
useCssVars((_ctx) => ({
|
|
115
|
+
"1f434a4e": _ctx.maskOpacity
|
|
116
|
+
}));
|
|
117
|
+
const props = __props;
|
|
118
|
+
const emit = __emit;
|
|
119
|
+
const showDialog = ref(props.modelValue);
|
|
120
|
+
watch(() => props.modelValue, (newVal) => {
|
|
121
|
+
showDialog.value = newVal;
|
|
122
|
+
});
|
|
123
|
+
watch(() => showDialog.value, (newVal) => {
|
|
124
|
+
emit("update:modelValue", newVal);
|
|
125
|
+
});
|
|
126
|
+
function handleMaskClick() {
|
|
127
|
+
if (props.closeOnMaskClick) {
|
|
128
|
+
showDialog.value = false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function handleConfirm() {
|
|
132
|
+
emit("confirm");
|
|
133
|
+
showDialog.value = false;
|
|
134
|
+
}
|
|
135
|
+
function handleCancel() {
|
|
136
|
+
emit("cancel");
|
|
137
|
+
showDialog.value = false;
|
|
138
|
+
}
|
|
139
|
+
return (_ctx, _cache) => {
|
|
140
|
+
return showDialog.value ? (openBlock(), createElementBlock("view", {
|
|
141
|
+
key: 0,
|
|
142
|
+
class: "dialog-wrapper",
|
|
143
|
+
onClick: handleMaskClick
|
|
144
|
+
}, [
|
|
145
|
+
createElementVNode("view", {
|
|
146
|
+
class: "dialog-container",
|
|
147
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
148
|
+
}, ["stop"]))
|
|
149
|
+
}, [
|
|
150
|
+
createElementVNode("view", _hoisted_1$9, [
|
|
151
|
+
createElementVNode("view", _hoisted_2$8, [
|
|
152
|
+
_ctx.icon ? (openBlock(), createElementBlock("image", {
|
|
153
|
+
key: 0,
|
|
154
|
+
src: _ctx.icon,
|
|
155
|
+
alt: "dialog-icon"
|
|
156
|
+
}, null, 8, _hoisted_3$8)) : (openBlock(), createElementBlock("view", _hoisted_4$6))
|
|
157
|
+
]),
|
|
158
|
+
createElementVNode("text", _hoisted_5$4, toDisplayString(_ctx.title), 1),
|
|
159
|
+
createElementVNode("text", _hoisted_6$4, toDisplayString(_ctx.description), 1)
|
|
160
|
+
]),
|
|
161
|
+
_hoisted_7$4,
|
|
162
|
+
createElementVNode("view", _hoisted_8$4, [
|
|
163
|
+
_ctx.type === "open-app" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
164
|
+
createElementVNode("view", {
|
|
165
|
+
class: "dialog-button dialog-button-cancel",
|
|
166
|
+
onClick: handleCancel
|
|
167
|
+
}, " 取消 "),
|
|
168
|
+
createElementVNode("view", {
|
|
169
|
+
class: "dialog-button dialog-button-primary",
|
|
170
|
+
onClick: handleConfirm
|
|
171
|
+
}, " 打开app ")
|
|
172
|
+
], 64)) : _ctx.type === "confirm" ? (openBlock(), createElementBlock("view", {
|
|
173
|
+
key: 1,
|
|
174
|
+
class: "dialog-button dialog-button-full dialog-button-primary",
|
|
175
|
+
onClick: handleConfirm
|
|
176
|
+
}, " 知道了 ")) : _ctx.type === "continue" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
177
|
+
createElementVNode("view", {
|
|
178
|
+
class: "dialog-button dialog-button-cancel",
|
|
179
|
+
onClick: handleCancel
|
|
180
|
+
}, " 取消 "),
|
|
181
|
+
createElementVNode("view", {
|
|
182
|
+
class: "dialog-button dialog-button-primary",
|
|
183
|
+
onClick: handleConfirm
|
|
184
|
+
}, " 继续访问 ")
|
|
185
|
+
], 64)) : createCommentVNode("", true)
|
|
186
|
+
])
|
|
187
|
+
])
|
|
188
|
+
])) : createCommentVNode("", true);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const index$6 = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a2785685"]]);
|
|
193
|
+
const _hoisted_1$8 = {
|
|
194
|
+
key: 0,
|
|
195
|
+
class: "sw-divider__text"
|
|
196
|
+
};
|
|
197
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
198
|
+
__name: "index",
|
|
199
|
+
props: {
|
|
200
|
+
vertical: { type: Boolean, default: false },
|
|
201
|
+
dashed: { type: Boolean, default: false },
|
|
202
|
+
position: { default: "center" },
|
|
203
|
+
customClass: { default: "" },
|
|
204
|
+
customStyle: { default: () => ({}) }
|
|
205
|
+
},
|
|
206
|
+
setup(__props) {
|
|
207
|
+
return (_ctx, _cache) => {
|
|
208
|
+
return openBlock(), createElementBlock("view", {
|
|
209
|
+
class: normalizeClass(["sw-divider", [
|
|
210
|
+
{ "is-vertical": _ctx.vertical },
|
|
211
|
+
{ "is-dashed": _ctx.dashed },
|
|
212
|
+
{ [`sw-divider--${_ctx.position}`]: _ctx.position !== "center" }
|
|
213
|
+
]])
|
|
214
|
+
}, [
|
|
215
|
+
_ctx.$slots.default ? (openBlock(), createElementBlock("text", _hoisted_1$8, [
|
|
216
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
217
|
+
])) : createCommentVNode("", true)
|
|
218
|
+
], 2);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
const index$5 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-b668cd0b"]]);
|
|
223
|
+
const _withScopeId$2 = (n) => (pushScopeId("data-v-00bcefd1"), n = n(), popScopeId(), n);
|
|
224
|
+
const _hoisted_1$7 = {
|
|
225
|
+
key: 0,
|
|
226
|
+
class: "popup-header"
|
|
227
|
+
};
|
|
228
|
+
const _hoisted_2$7 = {
|
|
229
|
+
key: 1,
|
|
230
|
+
class: "popup-header"
|
|
231
|
+
};
|
|
232
|
+
const _hoisted_3$7 = { class: "popup-title" };
|
|
233
|
+
const _hoisted_4$5 = { class: "popup-content" };
|
|
234
|
+
const _hoisted_5$3 = {
|
|
235
|
+
key: 2,
|
|
236
|
+
class: "popup-footer"
|
|
237
|
+
};
|
|
238
|
+
const _hoisted_6$3 = {
|
|
239
|
+
key: 3,
|
|
240
|
+
class: "popup-footer"
|
|
241
|
+
};
|
|
242
|
+
const _hoisted_7$3 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("text", { class: "close-icon" }, "×", -1));
|
|
243
|
+
const _hoisted_8$3 = [
|
|
244
|
+
_hoisted_7$3
|
|
245
|
+
];
|
|
246
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
247
|
+
__name: "index",
|
|
248
|
+
props: {
|
|
249
|
+
modelValue: { type: Boolean, default: false },
|
|
250
|
+
title: { default: "" },
|
|
251
|
+
position: { default: "center" },
|
|
252
|
+
animation: { default: "slide" },
|
|
253
|
+
mask: { type: Boolean, default: true },
|
|
254
|
+
maskOpacity: { default: 0.5 },
|
|
255
|
+
closeOnMaskClick: { type: Boolean, default: true },
|
|
256
|
+
showCloseButton: { type: Boolean, default: true },
|
|
257
|
+
closeOnEsc: { type: Boolean, default: true },
|
|
258
|
+
showConfirmButton: { type: Boolean, default: false },
|
|
259
|
+
confirmText: { default: "确定" },
|
|
260
|
+
showCancelButton: { type: Boolean, default: false },
|
|
261
|
+
cancelText: { default: "取消" },
|
|
262
|
+
width: { default: "50%" },
|
|
263
|
+
height: { default: "100%" },
|
|
264
|
+
maxWidth: { default: "500px" },
|
|
265
|
+
lockScroll: { type: Boolean, default: true }
|
|
266
|
+
},
|
|
267
|
+
emits: ["update:modelValue", "open", "close", "maskClick", "confirm", "cancel", "closeButtonClick"],
|
|
268
|
+
setup(__props, { emit: __emit }) {
|
|
269
|
+
const props = __props;
|
|
270
|
+
const emit = __emit;
|
|
271
|
+
const popupRef = ref(null);
|
|
272
|
+
const showPopup = ref(props.modelValue);
|
|
273
|
+
const isClosing = ref(false);
|
|
274
|
+
const lastScrollY = ref(0);
|
|
275
|
+
watch(() => props.modelValue, (newVal) => {
|
|
276
|
+
showPopup.value = newVal;
|
|
277
|
+
if (newVal) {
|
|
278
|
+
onOpen();
|
|
279
|
+
} else {
|
|
280
|
+
onClose();
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
watch(() => showPopup.value, (newVal) => {
|
|
284
|
+
emit("update:modelValue", newVal);
|
|
285
|
+
if (newVal) {
|
|
286
|
+
onOpen();
|
|
287
|
+
} else {
|
|
288
|
+
onClose();
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
function onOpen() {
|
|
292
|
+
if (props.lockScroll) {
|
|
293
|
+
lockScroll();
|
|
294
|
+
}
|
|
295
|
+
if (props.closeOnEsc) {
|
|
296
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
297
|
+
}
|
|
298
|
+
emit("open");
|
|
299
|
+
}
|
|
300
|
+
function onClose() {
|
|
301
|
+
if (props.lockScroll) {
|
|
302
|
+
unlockScroll();
|
|
303
|
+
}
|
|
304
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
305
|
+
emit("close");
|
|
306
|
+
}
|
|
307
|
+
function lockScroll() {
|
|
308
|
+
lastScrollY.value = window.scrollY;
|
|
309
|
+
document.body.style.position = "fixed";
|
|
310
|
+
document.body.style.top = `-${lastScrollY.value}px`;
|
|
311
|
+
document.body.style.left = "0";
|
|
312
|
+
document.body.style.right = "0";
|
|
313
|
+
document.body.style.overflow = "hidden";
|
|
314
|
+
uni.hideTabBar();
|
|
315
|
+
}
|
|
316
|
+
function unlockScroll() {
|
|
317
|
+
document.body.style.position = "";
|
|
318
|
+
document.body.style.top = "";
|
|
319
|
+
document.body.style.left = "";
|
|
320
|
+
document.body.style.right = "";
|
|
321
|
+
document.body.style.overflow = "";
|
|
322
|
+
window.scrollTo(0, lastScrollY.value);
|
|
323
|
+
uni.showTabBar();
|
|
324
|
+
}
|
|
325
|
+
function handleKeyDown(e) {
|
|
326
|
+
if (e.key === "Escape" && props.closeOnEsc && showPopup.value) {
|
|
327
|
+
handleClose();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function handleMaskClick() {
|
|
331
|
+
if (props.closeOnMaskClick) {
|
|
332
|
+
handleClose();
|
|
333
|
+
}
|
|
334
|
+
emit("maskClick");
|
|
335
|
+
}
|
|
336
|
+
function handleClose() {
|
|
337
|
+
isClosing.value = true;
|
|
338
|
+
emit("closeButtonClick");
|
|
339
|
+
}
|
|
340
|
+
function handleAnimationEnd() {
|
|
341
|
+
if (isClosing.value) {
|
|
342
|
+
isClosing.value = false;
|
|
343
|
+
showPopup.value = false;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
function handleConfirm() {
|
|
347
|
+
emit("confirm");
|
|
348
|
+
}
|
|
349
|
+
function handleCancel() {
|
|
350
|
+
emit("cancel");
|
|
351
|
+
handleClose();
|
|
352
|
+
}
|
|
353
|
+
onMounted(() => {
|
|
354
|
+
if (showPopup.value) {
|
|
355
|
+
onOpen();
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
onUnmounted(() => {
|
|
359
|
+
if (showPopup.value) {
|
|
360
|
+
onClose();
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
return (_ctx, _cache) => {
|
|
364
|
+
return withDirectives((openBlock(), createElementBlock("view", {
|
|
365
|
+
class: normalizeClass(["popup-wrapper", {
|
|
366
|
+
"modal": _ctx.mask,
|
|
367
|
+
"non-modal": !_ctx.mask,
|
|
368
|
+
"closing": isClosing.value
|
|
369
|
+
}]),
|
|
370
|
+
onClick: withModifiers(handleMaskClick, ["self"])
|
|
371
|
+
}, [
|
|
372
|
+
_ctx.mask ? (openBlock(), createElementBlock("view", {
|
|
373
|
+
key: 0,
|
|
374
|
+
class: "popup-mask",
|
|
375
|
+
style: normalizeStyle({ opacity: _ctx.maskOpacity }),
|
|
376
|
+
onClick: handleMaskClick
|
|
377
|
+
}, null, 4)) : createCommentVNode("", true),
|
|
378
|
+
createElementVNode("view", {
|
|
379
|
+
ref_key: "popupRef",
|
|
380
|
+
ref: popupRef,
|
|
381
|
+
class: normalizeClass(["popup-container", [
|
|
382
|
+
`position-${_ctx.position}`,
|
|
383
|
+
`animation-${_ctx.animation}`,
|
|
384
|
+
{ closing: isClosing.value }
|
|
385
|
+
]]),
|
|
386
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
387
|
+
}, ["stop"])),
|
|
388
|
+
onTouchmove: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
389
|
+
}, ["stop"])),
|
|
390
|
+
onAnimationend: handleAnimationEnd
|
|
391
|
+
}, [
|
|
392
|
+
_ctx.$slots.header ? (openBlock(), createElementBlock("view", _hoisted_1$7, [
|
|
393
|
+
renderSlot(_ctx.$slots, "header", {}, void 0, true)
|
|
394
|
+
])) : _ctx.title ? (openBlock(), createElementBlock("view", _hoisted_2$7, [
|
|
395
|
+
createElementVNode("text", _hoisted_3$7, toDisplayString(_ctx.title), 1)
|
|
396
|
+
])) : createCommentVNode("", true),
|
|
397
|
+
createElementVNode("view", _hoisted_4$5, [
|
|
398
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
399
|
+
]),
|
|
400
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("view", _hoisted_5$3, [
|
|
401
|
+
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
402
|
+
])) : _ctx.showConfirmButton || _ctx.showCancelButton ? (openBlock(), createElementBlock("view", _hoisted_6$3, [
|
|
403
|
+
_ctx.showCancelButton ? (openBlock(), createElementBlock("view", {
|
|
404
|
+
key: 0,
|
|
405
|
+
class: "popup-button popup-button-cancel",
|
|
406
|
+
onClick: handleCancel
|
|
407
|
+
}, toDisplayString(_ctx.cancelText), 1)) : createCommentVNode("", true),
|
|
408
|
+
_ctx.showConfirmButton ? (openBlock(), createElementBlock("view", {
|
|
409
|
+
key: 1,
|
|
410
|
+
class: "popup-button popup-button-confirm",
|
|
411
|
+
onClick: handleConfirm
|
|
412
|
+
}, toDisplayString(_ctx.confirmText), 1)) : createCommentVNode("", true)
|
|
413
|
+
])) : createCommentVNode("", true),
|
|
414
|
+
_ctx.showCloseButton ? (openBlock(), createElementBlock("view", {
|
|
415
|
+
key: 4,
|
|
416
|
+
class: "popup-close-button",
|
|
417
|
+
onClick: handleClose
|
|
418
|
+
}, _hoisted_8$3)) : createCommentVNode("", true)
|
|
419
|
+
], 34)
|
|
420
|
+
], 2)), [
|
|
421
|
+
[vShow, showPopup.value]
|
|
422
|
+
]);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
const index$4 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-00bcefd1"]]);
|
|
427
|
+
const _hoisted_1$6 = {
|
|
428
|
+
key: 0,
|
|
429
|
+
class: "sw-toast__loading"
|
|
430
|
+
};
|
|
431
|
+
const _hoisted_2$6 = {
|
|
432
|
+
key: 0,
|
|
433
|
+
class: "sw-toast__spinner"
|
|
434
|
+
};
|
|
435
|
+
const _hoisted_3$6 = {
|
|
436
|
+
key: 1,
|
|
437
|
+
class: "sw-toast__custom-icon"
|
|
438
|
+
};
|
|
439
|
+
const _hoisted_4$4 = {
|
|
440
|
+
key: 1,
|
|
441
|
+
class: "sw-toast__icon"
|
|
442
|
+
};
|
|
443
|
+
const _hoisted_5$2 = {
|
|
444
|
+
key: 0,
|
|
445
|
+
class: "sw-toast__icon--success"
|
|
446
|
+
};
|
|
447
|
+
const _hoisted_6$2 = {
|
|
448
|
+
key: 1,
|
|
449
|
+
class: "sw-toast__icon--fail"
|
|
450
|
+
};
|
|
451
|
+
const _hoisted_7$2 = {
|
|
452
|
+
key: 2,
|
|
453
|
+
class: "sw-toast__custom-icon"
|
|
454
|
+
};
|
|
455
|
+
const _hoisted_8$2 = {
|
|
456
|
+
key: 2,
|
|
457
|
+
class: "sw-toast__text"
|
|
458
|
+
};
|
|
459
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
460
|
+
__name: "index",
|
|
461
|
+
props: {
|
|
462
|
+
modelValue: { type: Boolean, default: false },
|
|
463
|
+
type: { default: "text" },
|
|
464
|
+
position: { default: "middle" },
|
|
465
|
+
message: { default: "" },
|
|
466
|
+
duration: { default: 3e3 },
|
|
467
|
+
loading: { type: Boolean, default: false },
|
|
468
|
+
icon: { type: Boolean, default: true },
|
|
469
|
+
customIcon: { default: "" },
|
|
470
|
+
large: { type: Boolean, default: false },
|
|
471
|
+
customStyle: { default: () => ({}) }
|
|
472
|
+
},
|
|
473
|
+
emits: ["update:modelValue", "close", "click"],
|
|
474
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
475
|
+
const props = __props;
|
|
476
|
+
const emit = __emit;
|
|
477
|
+
const toastRef = ref(null);
|
|
478
|
+
let timer = null;
|
|
479
|
+
const showToast = ref(props.modelValue);
|
|
480
|
+
const isClosing = ref(false);
|
|
481
|
+
const showIcon = computed(() => {
|
|
482
|
+
if (props.loading)
|
|
483
|
+
return true;
|
|
484
|
+
if (props.type === "text")
|
|
485
|
+
return props.icon;
|
|
486
|
+
return true;
|
|
487
|
+
});
|
|
488
|
+
function onClick() {
|
|
489
|
+
emit("click");
|
|
490
|
+
}
|
|
491
|
+
function close() {
|
|
492
|
+
if (!showToast.value)
|
|
493
|
+
return;
|
|
494
|
+
isClosing.value = true;
|
|
495
|
+
emit("close");
|
|
496
|
+
}
|
|
497
|
+
function startTimer() {
|
|
498
|
+
clearTimer();
|
|
499
|
+
if (props.duration > 0 && !props.loading) {
|
|
500
|
+
timer = setTimeout(() => {
|
|
501
|
+
close();
|
|
502
|
+
}, props.duration);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function clearTimer() {
|
|
506
|
+
if (timer) {
|
|
507
|
+
clearTimeout(timer);
|
|
508
|
+
timer = null;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function handleTransitionEnd() {
|
|
512
|
+
if (isClosing.value) {
|
|
513
|
+
showToast.value = false;
|
|
514
|
+
isClosing.value = false;
|
|
515
|
+
emit("update:modelValue", false);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
watch(() => props.modelValue, (newVal) => {
|
|
519
|
+
if (newVal) {
|
|
520
|
+
showToast.value = true;
|
|
521
|
+
isClosing.value = false;
|
|
522
|
+
startTimer();
|
|
523
|
+
} else {
|
|
524
|
+
close();
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
watch(() => props.message, () => {
|
|
528
|
+
if (showToast.value && !props.loading) {
|
|
529
|
+
startTimer();
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
onMounted(() => {
|
|
533
|
+
if (props.modelValue) {
|
|
534
|
+
startTimer();
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
onUnmounted(() => {
|
|
538
|
+
clearTimer();
|
|
539
|
+
});
|
|
540
|
+
__expose({
|
|
541
|
+
/**
|
|
542
|
+
* 手动关闭Toast
|
|
543
|
+
*/
|
|
544
|
+
close
|
|
545
|
+
});
|
|
546
|
+
return (_ctx, _cache) => {
|
|
547
|
+
return withDirectives((openBlock(), createElementBlock("view", {
|
|
548
|
+
ref_key: "toastRef",
|
|
549
|
+
ref: toastRef,
|
|
550
|
+
class: normalizeClass(["sw-toast", [
|
|
551
|
+
`sw-toast--${_ctx.type}`,
|
|
552
|
+
`sw-toast--${_ctx.position}`,
|
|
553
|
+
{ "sw-toast--large": _ctx.large },
|
|
554
|
+
{ "sw-toast--text": !showIcon.value && _ctx.type === "text" },
|
|
555
|
+
{ "sw-toast--show": showToast.value && !isClosing.value },
|
|
556
|
+
{ "sw-toast--hide": showToast.value && isClosing.value }
|
|
557
|
+
]]),
|
|
558
|
+
style: normalizeStyle(_ctx.customStyle),
|
|
559
|
+
onClick,
|
|
560
|
+
onTransitionend: handleTransitionEnd
|
|
561
|
+
}, [
|
|
562
|
+
_ctx.loading ? (openBlock(), createElementBlock("view", _hoisted_1$6, [
|
|
563
|
+
!_ctx.customIcon ? (openBlock(), createElementBlock("text", _hoisted_2$6)) : (openBlock(), createElementBlock("text", _hoisted_3$6, toDisplayString(_ctx.customIcon), 1))
|
|
564
|
+
])) : showIcon.value ? (openBlock(), createElementBlock("view", _hoisted_4$4, [
|
|
565
|
+
_ctx.type === "success" ? (openBlock(), createElementBlock("text", _hoisted_5$2, "✓")) : _ctx.type === "fail" ? (openBlock(), createElementBlock("text", _hoisted_6$2, "✗")) : _ctx.customIcon ? (openBlock(), createElementBlock("text", _hoisted_7$2, toDisplayString(_ctx.customIcon), 1)) : createCommentVNode("", true)
|
|
566
|
+
])) : createCommentVNode("", true),
|
|
567
|
+
_ctx.message ? (openBlock(), createElementBlock("text", _hoisted_8$2, toDisplayString(_ctx.message), 1)) : createCommentVNode("", true)
|
|
568
|
+
], 38)), [
|
|
569
|
+
[vShow, showToast.value]
|
|
570
|
+
]);
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-2b648fd9"]]);
|
|
575
|
+
const _hoisted_1$5 = { class: "sw-swiper" };
|
|
576
|
+
const _hoisted_2$5 = {
|
|
577
|
+
key: 0,
|
|
578
|
+
class: "swiper-indicators"
|
|
579
|
+
};
|
|
580
|
+
const _hoisted_3$5 = ["onClick"];
|
|
581
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
582
|
+
__name: "index",
|
|
583
|
+
props: {
|
|
584
|
+
items: {},
|
|
585
|
+
initialIndex: { default: 0 },
|
|
586
|
+
autoPlay: { type: Boolean, default: true },
|
|
587
|
+
interval: { default: 3e3 },
|
|
588
|
+
duration: { default: 300 },
|
|
589
|
+
showIndicators: { type: Boolean, default: true },
|
|
590
|
+
showArrows: { type: Boolean, default: false },
|
|
591
|
+
loop: { type: Boolean, default: true }
|
|
592
|
+
},
|
|
593
|
+
emits: ["change", "prev", "next"],
|
|
594
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
595
|
+
const props = __props;
|
|
596
|
+
const emit = __emit;
|
|
597
|
+
const currentIndex = ref(props.initialIndex);
|
|
598
|
+
let timer = null;
|
|
599
|
+
function startAutoPlay() {
|
|
600
|
+
if (props.autoPlay && props.items.length > 1) {
|
|
601
|
+
timer = setInterval(() => {
|
|
602
|
+
next();
|
|
603
|
+
}, props.interval);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
function stopAutoPlay() {
|
|
607
|
+
if (timer) {
|
|
608
|
+
clearInterval(timer);
|
|
609
|
+
timer = null;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
function prev() {
|
|
613
|
+
if (props.loop) {
|
|
614
|
+
currentIndex.value = currentIndex.value === 0 ? props.items.length - 1 : currentIndex.value - 1;
|
|
615
|
+
} else if (currentIndex.value > 0) {
|
|
616
|
+
currentIndex.value--;
|
|
617
|
+
}
|
|
618
|
+
emit("prev", currentIndex.value);
|
|
619
|
+
emit("change", currentIndex.value);
|
|
620
|
+
}
|
|
621
|
+
function next() {
|
|
622
|
+
if (props.loop) {
|
|
623
|
+
currentIndex.value = currentIndex.value === props.items.length - 1 ? 0 : currentIndex.value + 1;
|
|
624
|
+
} else if (currentIndex.value < props.items.length - 1) {
|
|
625
|
+
currentIndex.value++;
|
|
626
|
+
}
|
|
627
|
+
emit("next", currentIndex.value);
|
|
628
|
+
emit("change", currentIndex.value);
|
|
629
|
+
}
|
|
630
|
+
watch(() => props.items, (newItems) => {
|
|
631
|
+
if (newItems.length < currentIndex.value + 1) {
|
|
632
|
+
currentIndex.value = Math.min(currentIndex.value, newItems.length - 1);
|
|
633
|
+
}
|
|
634
|
+
stopAutoPlay();
|
|
635
|
+
startAutoPlay();
|
|
636
|
+
}, { deep: true });
|
|
637
|
+
watch(() => props.autoPlay, (autoPlay) => {
|
|
638
|
+
if (autoPlay) {
|
|
639
|
+
startAutoPlay();
|
|
640
|
+
} else {
|
|
641
|
+
stopAutoPlay();
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
onMounted(() => {
|
|
645
|
+
startAutoPlay();
|
|
646
|
+
});
|
|
647
|
+
onUnmounted(() => {
|
|
648
|
+
stopAutoPlay();
|
|
649
|
+
});
|
|
650
|
+
__expose({
|
|
651
|
+
prev,
|
|
652
|
+
next,
|
|
653
|
+
currentIndex
|
|
654
|
+
});
|
|
655
|
+
return (_ctx, _cache) => {
|
|
656
|
+
return openBlock(), createElementBlock("view", _hoisted_1$5, [
|
|
657
|
+
createElementVNode("view", {
|
|
658
|
+
class: "swiper-wrapper",
|
|
659
|
+
style: normalizeStyle({
|
|
660
|
+
transform: `translateX(-${currentIndex.value * 100}%)`,
|
|
661
|
+
transition: `transform ${_ctx.duration}ms ease`
|
|
662
|
+
})
|
|
663
|
+
}, [
|
|
664
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item, index2) => {
|
|
665
|
+
return openBlock(), createElementBlock("view", {
|
|
666
|
+
key: index2,
|
|
667
|
+
class: "swiper-item"
|
|
668
|
+
}, [
|
|
669
|
+
renderSlot(_ctx.$slots, "default", {
|
|
670
|
+
item,
|
|
671
|
+
index: index2
|
|
672
|
+
}, void 0, true)
|
|
673
|
+
]);
|
|
674
|
+
}), 128))
|
|
675
|
+
], 4),
|
|
676
|
+
_ctx.showIndicators ? (openBlock(), createElementBlock("view", _hoisted_2$5, [
|
|
677
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item, index2) => {
|
|
678
|
+
return openBlock(), createElementBlock("view", {
|
|
679
|
+
key: index2,
|
|
680
|
+
class: normalizeClass(["indicator-item", { active: index2 === currentIndex.value }]),
|
|
681
|
+
onClick: ($event) => currentIndex.value = index2
|
|
682
|
+
}, null, 10, _hoisted_3$5);
|
|
683
|
+
}), 128))
|
|
684
|
+
])) : createCommentVNode("", true),
|
|
685
|
+
_ctx.showArrows ? (openBlock(), createElementBlock("view", {
|
|
686
|
+
key: 1,
|
|
687
|
+
class: "swiper-arrow swiper-arrow-left",
|
|
688
|
+
onClick: prev
|
|
689
|
+
})) : createCommentVNode("", true),
|
|
690
|
+
_ctx.showArrows ? (openBlock(), createElementBlock("view", {
|
|
691
|
+
key: 2,
|
|
692
|
+
class: "swiper-arrow swiper-arrow-right",
|
|
693
|
+
onClick: next
|
|
694
|
+
})) : createCommentVNode("", true)
|
|
695
|
+
]);
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
const index$2 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-3735cbbd"]]);
|
|
700
|
+
const _withScopeId$1 = (n) => (pushScopeId("data-v-2e49050a"), n = n(), popScopeId(), n);
|
|
701
|
+
const _hoisted_1$4 = { class: "sw-infinite-scroll__content" };
|
|
702
|
+
const _hoisted_2$4 = {
|
|
703
|
+
key: 0,
|
|
704
|
+
class: "sw-infinite-scroll__loading"
|
|
705
|
+
};
|
|
706
|
+
const _hoisted_3$4 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("view", { class: "loading-spinner" }, null, -1));
|
|
707
|
+
const _hoisted_4$3 = {
|
|
708
|
+
key: 1,
|
|
709
|
+
class: "sw-infinite-scroll__finished"
|
|
710
|
+
};
|
|
711
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
712
|
+
__name: "index",
|
|
713
|
+
props: {
|
|
714
|
+
loading: { type: Boolean, default: false },
|
|
715
|
+
finished: { type: Boolean, default: false },
|
|
716
|
+
offset: { default: 100 },
|
|
717
|
+
loadingText: { default: "加载中..." },
|
|
718
|
+
finishedText: { default: "没有更多了" },
|
|
719
|
+
disabled: { type: Boolean, default: false },
|
|
720
|
+
height: { default: "auto" }
|
|
721
|
+
},
|
|
722
|
+
emits: ["load"],
|
|
723
|
+
setup(__props, { emit: __emit }) {
|
|
724
|
+
const props = __props;
|
|
725
|
+
const emit = __emit;
|
|
726
|
+
const scrollContainer = ref(null);
|
|
727
|
+
const containerStyle = computed(() => {
|
|
728
|
+
return {
|
|
729
|
+
height: typeof props.height === "number" ? `${props.height}px` : props.height
|
|
730
|
+
};
|
|
731
|
+
});
|
|
732
|
+
function handleScroll() {
|
|
733
|
+
if (!scrollContainer.value || props.loading || props.finished || props.disabled) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
const { scrollTop, scrollHeight, clientHeight } = scrollContainer.value;
|
|
737
|
+
if (scrollHeight - scrollTop - clientHeight <= props.offset) {
|
|
738
|
+
emit("load");
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
let resizeTimeout = null;
|
|
742
|
+
function handleResize() {
|
|
743
|
+
if (resizeTimeout) {
|
|
744
|
+
clearTimeout(resizeTimeout);
|
|
745
|
+
}
|
|
746
|
+
resizeTimeout = setTimeout(() => {
|
|
747
|
+
handleScroll();
|
|
748
|
+
}, 100);
|
|
749
|
+
}
|
|
750
|
+
onMounted(() => {
|
|
751
|
+
handleScroll();
|
|
752
|
+
window.addEventListener("resize", handleResize);
|
|
753
|
+
});
|
|
754
|
+
onUnmounted(() => {
|
|
755
|
+
window.removeEventListener("resize", handleResize);
|
|
756
|
+
if (resizeTimeout) {
|
|
757
|
+
clearTimeout(resizeTimeout);
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
return (_ctx, _cache) => {
|
|
761
|
+
return openBlock(), createElementBlock("view", {
|
|
762
|
+
ref_key: "scrollContainer",
|
|
763
|
+
ref: scrollContainer,
|
|
764
|
+
class: "sw-infinite-scroll",
|
|
765
|
+
style: normalizeStyle(containerStyle.value),
|
|
766
|
+
onScroll: handleScroll
|
|
767
|
+
}, [
|
|
768
|
+
createElementVNode("view", _hoisted_1$4, [
|
|
769
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
770
|
+
]),
|
|
771
|
+
_ctx.loading ? (openBlock(), createElementBlock("view", _hoisted_2$4, [
|
|
772
|
+
_hoisted_3$4,
|
|
773
|
+
createElementVNode("text", null, toDisplayString(_ctx.loadingText), 1)
|
|
774
|
+
])) : createCommentVNode("", true),
|
|
775
|
+
_ctx.finished && !_ctx.loading ? (openBlock(), createElementBlock("view", _hoisted_4$3, toDisplayString(_ctx.finishedText), 1)) : createCommentVNode("", true)
|
|
776
|
+
], 36);
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2e49050a"]]);
|
|
781
|
+
const _withScopeId = (n) => (pushScopeId("data-v-d2876eca"), n = n(), popScopeId(), n);
|
|
782
|
+
const _hoisted_1$3 = {
|
|
783
|
+
key: 0,
|
|
784
|
+
class: "refresh-content"
|
|
785
|
+
};
|
|
786
|
+
const _hoisted_2$3 = { class: "refresh-icon" };
|
|
787
|
+
const _hoisted_3$3 = {
|
|
788
|
+
key: 0,
|
|
789
|
+
class: "refresh-loading"
|
|
790
|
+
};
|
|
791
|
+
const _hoisted_4$2 = {
|
|
792
|
+
key: 1,
|
|
793
|
+
class: "refresh-arrow"
|
|
794
|
+
};
|
|
795
|
+
const _hoisted_5$1 = { class: "refresh-text" };
|
|
796
|
+
const _hoisted_6$1 = { class: "infinite-scroll-content" };
|
|
797
|
+
const _hoisted_7$1 = { class: "infinite-scroll-indicator" };
|
|
798
|
+
const _hoisted_8$1 = {
|
|
799
|
+
key: 0,
|
|
800
|
+
class: "infinite-scroll-loading"
|
|
801
|
+
};
|
|
802
|
+
const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("view", { class: "loading-spinner" }, [
|
|
803
|
+
/* @__PURE__ */ createElementVNode("text", { class: "loading-icon" }, "●")
|
|
804
|
+
], -1));
|
|
805
|
+
const _hoisted_10 = { class: "loading-text" };
|
|
806
|
+
const _hoisted_11 = {
|
|
807
|
+
key: 1,
|
|
808
|
+
class: "infinite-scroll-error"
|
|
809
|
+
};
|
|
810
|
+
const _hoisted_12 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("text", { class: "error-icon" }, "×", -1));
|
|
811
|
+
const _hoisted_13 = { class: "error-text" };
|
|
812
|
+
const _hoisted_14 = {
|
|
813
|
+
key: 2,
|
|
814
|
+
class: "infinite-scroll-no-more"
|
|
815
|
+
};
|
|
816
|
+
const _hoisted_15 = { class: "no-more-text" };
|
|
817
|
+
const _hoisted_16 = {
|
|
818
|
+
key: 3,
|
|
819
|
+
class: "infinite-scroll-trigger",
|
|
820
|
+
style: { height: `0px` }
|
|
821
|
+
};
|
|
822
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
823
|
+
__name: "index",
|
|
824
|
+
props: {
|
|
825
|
+
loading: { type: Boolean, default: false },
|
|
826
|
+
refreshLoading: { type: Boolean, default: false },
|
|
827
|
+
hasMore: { type: Boolean, default: true },
|
|
828
|
+
error: { type: Boolean, default: false },
|
|
829
|
+
threshold: { default: 30 },
|
|
830
|
+
refreshThreshold: { default: 40 },
|
|
831
|
+
throttleTime: { default: 200 },
|
|
832
|
+
loadingText: { default: "加载中..." },
|
|
833
|
+
errorText: { default: "加载失败" },
|
|
834
|
+
retryText: { default: "点击重试" },
|
|
835
|
+
noMoreText: { default: "没有更多数据了" },
|
|
836
|
+
refreshText: { default: "下拉刷新" },
|
|
837
|
+
releaseText: { default: "释放可刷新" },
|
|
838
|
+
refreshingText: { default: "正在刷新..." },
|
|
839
|
+
refreshSuccessText: { default: "刷新成功" },
|
|
840
|
+
refreshErrorText: { default: "刷新失败" },
|
|
841
|
+
useWindowScroll: { type: Boolean, default: false },
|
|
842
|
+
enableInfiniteScroll: { type: Boolean, default: false },
|
|
843
|
+
enableRefresh: { type: Boolean, default: true }
|
|
844
|
+
},
|
|
845
|
+
emits: ["loadMore", "retry", "refresh"],
|
|
846
|
+
setup(__props, { emit: __emit }) {
|
|
847
|
+
const props = __props;
|
|
848
|
+
const emit = __emit;
|
|
849
|
+
const containerRef = ref(null);
|
|
850
|
+
let scrollContainer = null;
|
|
851
|
+
let lastScrollTime = 0;
|
|
852
|
+
const pullDistance = ref(0);
|
|
853
|
+
const startY = ref(0);
|
|
854
|
+
const isPulling = ref(false);
|
|
855
|
+
const isRefreshing = ref(false);
|
|
856
|
+
const refreshStatus = ref("normal");
|
|
857
|
+
function getScrollContainer() {
|
|
858
|
+
if (props.useWindowScroll) {
|
|
859
|
+
return window;
|
|
860
|
+
}
|
|
861
|
+
return containerRef.value;
|
|
862
|
+
}
|
|
863
|
+
function throttle(fn, delay) {
|
|
864
|
+
return (...args) => {
|
|
865
|
+
const now = Date.now();
|
|
866
|
+
if (now - lastScrollTime >= delay) {
|
|
867
|
+
lastScrollTime = now;
|
|
868
|
+
fn.apply(null, args);
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
function checkLoadMore() {
|
|
873
|
+
if (!props.enableInfiniteScroll) {
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (props.loading || !props.hasMore || props.error) {
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
let scrollTop = 0;
|
|
880
|
+
let scrollHeight = 0;
|
|
881
|
+
let clientHeight = 0;
|
|
882
|
+
if (props.useWindowScroll) {
|
|
883
|
+
scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
|
884
|
+
scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
|
|
885
|
+
clientHeight = window.innerHeight;
|
|
886
|
+
} else {
|
|
887
|
+
if (!containerRef.value)
|
|
888
|
+
return;
|
|
889
|
+
if (typeof containerRef.value.scrollTop !== "number" || typeof containerRef.value.scrollHeight !== "number" || typeof containerRef.value.clientHeight !== "number") {
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
scrollTop = containerRef.value.scrollTop;
|
|
893
|
+
scrollHeight = containerRef.value.scrollHeight;
|
|
894
|
+
clientHeight = containerRef.value.clientHeight;
|
|
895
|
+
}
|
|
896
|
+
if ((props.useWindowScroll ? scrollTop > 0 : true) && (scrollHeight <= clientHeight || scrollHeight - scrollTop - clientHeight <= props.threshold)) {
|
|
897
|
+
emit("loadMore");
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
function onRetry() {
|
|
901
|
+
emit("retry");
|
|
902
|
+
}
|
|
903
|
+
function handleTouchStart(e) {
|
|
904
|
+
var _a;
|
|
905
|
+
if (!props.enableRefresh || props.refreshLoading) {
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
let scrollTop = 0;
|
|
909
|
+
if (props.useWindowScroll) {
|
|
910
|
+
scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
|
911
|
+
} else {
|
|
912
|
+
scrollTop = ((_a = containerRef.value) == null ? void 0 : _a.scrollTop) || 0;
|
|
913
|
+
}
|
|
914
|
+
if (scrollTop > 0) {
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
startY.value = e.touches[0].clientY;
|
|
918
|
+
isPulling.value = true;
|
|
919
|
+
refreshStatus.value = "pulling";
|
|
920
|
+
}
|
|
921
|
+
function handleTouchMove(e) {
|
|
922
|
+
if (!isPulling.value || props.refreshLoading) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
const currentY = e.touches[0].clientY;
|
|
926
|
+
const distance = currentY - startY.value;
|
|
927
|
+
if (distance <= 0) {
|
|
928
|
+
if (pullDistance.value > 0) {
|
|
929
|
+
pullDistance.value = 0;
|
|
930
|
+
refreshStatus.value = "normal";
|
|
931
|
+
}
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
pullDistance.value = Math.min(distance * 0.5, props.refreshThreshold * 1.5);
|
|
935
|
+
if (pullDistance.value >= props.refreshThreshold) {
|
|
936
|
+
refreshStatus.value = "triggered";
|
|
937
|
+
} else {
|
|
938
|
+
refreshStatus.value = "pulling";
|
|
939
|
+
}
|
|
940
|
+
e.preventDefault();
|
|
941
|
+
}
|
|
942
|
+
function handleTouchEnd() {
|
|
943
|
+
if (!isPulling.value) {
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
isPulling.value = false;
|
|
947
|
+
if (pullDistance.value >= props.refreshThreshold && !props.refreshLoading) {
|
|
948
|
+
isRefreshing.value = true;
|
|
949
|
+
refreshStatus.value = "refreshing";
|
|
950
|
+
emit("refresh");
|
|
951
|
+
} else {
|
|
952
|
+
pullDistance.value = 0;
|
|
953
|
+
refreshStatus.value = "normal";
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
const handleScroll = throttle(() => {
|
|
957
|
+
checkLoadMore();
|
|
958
|
+
}, props.throttleTime);
|
|
959
|
+
function addScrollListener() {
|
|
960
|
+
nextTick(() => {
|
|
961
|
+
scrollContainer = getScrollContainer();
|
|
962
|
+
if (scrollContainer && typeof scrollContainer.addEventListener === "function") {
|
|
963
|
+
scrollContainer.addEventListener("scroll", handleScroll, { passive: true });
|
|
964
|
+
checkLoadMore();
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
function removeScrollListener() {
|
|
969
|
+
if (scrollContainer && typeof scrollContainer.removeEventListener === "function") {
|
|
970
|
+
scrollContainer.removeEventListener("scroll", handleScroll);
|
|
971
|
+
scrollContainer = null;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
const handleResize = throttle(() => {
|
|
975
|
+
checkLoadMore();
|
|
976
|
+
}, props.throttleTime);
|
|
977
|
+
watch(() => props.loading, (newVal) => {
|
|
978
|
+
if (!newVal) {
|
|
979
|
+
nextTick(() => {
|
|
980
|
+
checkLoadMore();
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
watch(() => props.error, (newVal) => {
|
|
985
|
+
if (!newVal) {
|
|
986
|
+
nextTick(() => {
|
|
987
|
+
checkLoadMore();
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
watch(() => props.refreshLoading, (newVal) => {
|
|
992
|
+
isRefreshing.value = newVal;
|
|
993
|
+
if (newVal) {
|
|
994
|
+
refreshStatus.value = "refreshing";
|
|
995
|
+
} else {
|
|
996
|
+
pullDistance.value = 0;
|
|
997
|
+
setTimeout(() => {
|
|
998
|
+
refreshStatus.value = "normal";
|
|
999
|
+
}, 300);
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
onMounted(() => {
|
|
1003
|
+
addScrollListener();
|
|
1004
|
+
window.addEventListener("resize", handleResize, { passive: true });
|
|
1005
|
+
});
|
|
1006
|
+
onUnmounted(() => {
|
|
1007
|
+
removeScrollListener();
|
|
1008
|
+
window.removeEventListener("resize", handleResize);
|
|
1009
|
+
});
|
|
1010
|
+
return (_ctx, _cache) => {
|
|
1011
|
+
return openBlock(), createElementBlock("view", {
|
|
1012
|
+
ref_key: "containerRef",
|
|
1013
|
+
ref: containerRef,
|
|
1014
|
+
class: "infinite-scroll-container",
|
|
1015
|
+
onTouchstart: handleTouchStart,
|
|
1016
|
+
onTouchmove: handleTouchMove,
|
|
1017
|
+
onTouchend: handleTouchEnd,
|
|
1018
|
+
onScroll: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1019
|
+
(...args) => unref(handleScroll) && unref(handleScroll)(...args))
|
|
1020
|
+
}, [
|
|
1021
|
+
createElementVNode("view", {
|
|
1022
|
+
class: "refresh-indicator",
|
|
1023
|
+
style: normalizeStyle({ height: `${pullDistance.value}px` })
|
|
1024
|
+
}, [
|
|
1025
|
+
refreshStatus.value !== "normal" && (refreshStatus.value === "refreshing" || pullDistance.value > 0) ? (openBlock(), createElementBlock("view", _hoisted_1$3, [
|
|
1026
|
+
createElementVNode("view", _hoisted_2$3, [
|
|
1027
|
+
props.refreshLoading ? (openBlock(), createElementBlock("text", _hoisted_3$3, "●")) : (openBlock(), createElementBlock("text", _hoisted_4$2, "↓"))
|
|
1028
|
+
]),
|
|
1029
|
+
createElementVNode("text", _hoisted_5$1, [
|
|
1030
|
+
props.refreshLoading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1031
|
+
createTextVNode(toDisplayString(props.refreshingText), 1)
|
|
1032
|
+
], 64)) : refreshStatus.value === "triggered" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1033
|
+
createTextVNode(toDisplayString(props.releaseText), 1)
|
|
1034
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
1035
|
+
createTextVNode(toDisplayString(props.refreshText), 1)
|
|
1036
|
+
], 64))
|
|
1037
|
+
])
|
|
1038
|
+
])) : createCommentVNode("", true)
|
|
1039
|
+
], 4),
|
|
1040
|
+
createElementVNode("view", _hoisted_6$1, [
|
|
1041
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1042
|
+
]),
|
|
1043
|
+
createElementVNode("view", _hoisted_7$1, [
|
|
1044
|
+
_ctx.loading ? (openBlock(), createElementBlock("view", _hoisted_8$1, [
|
|
1045
|
+
_hoisted_9,
|
|
1046
|
+
createElementVNode("text", _hoisted_10, toDisplayString(_ctx.loadingText), 1)
|
|
1047
|
+
])) : _ctx.error ? (openBlock(), createElementBlock("view", _hoisted_11, [
|
|
1048
|
+
_hoisted_12,
|
|
1049
|
+
createElementVNode("text", _hoisted_13, toDisplayString(_ctx.errorText), 1),
|
|
1050
|
+
createElementVNode("view", {
|
|
1051
|
+
class: "retry-btn",
|
|
1052
|
+
onClick: onRetry
|
|
1053
|
+
}, toDisplayString(_ctx.retryText), 1)
|
|
1054
|
+
])) : !_ctx.hasMore ? (openBlock(), createElementBlock("view", _hoisted_14, [
|
|
1055
|
+
createElementVNode("text", _hoisted_15, toDisplayString(_ctx.noMoreText), 1)
|
|
1056
|
+
])) : (openBlock(), createElementBlock("view", _hoisted_16))
|
|
1057
|
+
])
|
|
1058
|
+
], 544);
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-d2876eca"]]);
|
|
1063
|
+
function useDropdownSelect(props, emit) {
|
|
1064
|
+
const isOpen = ref(false);
|
|
1065
|
+
const displayText = computed(() => {
|
|
1066
|
+
var _a, _b;
|
|
1067
|
+
if (!((_a = props.options) == null ? void 0 : _a.length)) {
|
|
1068
|
+
return "请选择";
|
|
1069
|
+
}
|
|
1070
|
+
if (props.modelValue !== void 0 && props.modelValue !== null) {
|
|
1071
|
+
const matched = props.options.find(
|
|
1072
|
+
(opt) => opt.value === props.modelValue
|
|
1073
|
+
);
|
|
1074
|
+
if (matched)
|
|
1075
|
+
return matched.text;
|
|
1076
|
+
}
|
|
1077
|
+
return ((_b = props.options[0]) == null ? void 0 : _b.text) || "请选择";
|
|
1078
|
+
});
|
|
1079
|
+
const internalValue = computed({
|
|
1080
|
+
get() {
|
|
1081
|
+
var _a, _b;
|
|
1082
|
+
if (props.modelValue !== void 0 && props.modelValue !== null) {
|
|
1083
|
+
return props.modelValue;
|
|
1084
|
+
}
|
|
1085
|
+
return ((_b = (_a = props.options) == null ? void 0 : _a[0]) == null ? void 0 : _b.value) ?? "";
|
|
1086
|
+
},
|
|
1087
|
+
set(val) {
|
|
1088
|
+
emit("update:modelValue", val);
|
|
1089
|
+
}
|
|
1090
|
+
});
|
|
1091
|
+
const handleChange = (value) => {
|
|
1092
|
+
emit("change", value);
|
|
1093
|
+
};
|
|
1094
|
+
const handleOpen = () => {
|
|
1095
|
+
isOpen.value = true;
|
|
1096
|
+
};
|
|
1097
|
+
const handleClose = () => {
|
|
1098
|
+
isOpen.value = false;
|
|
1099
|
+
};
|
|
1100
|
+
return {
|
|
1101
|
+
displayText,
|
|
1102
|
+
internalValue,
|
|
1103
|
+
isOpen,
|
|
1104
|
+
handleChange,
|
|
1105
|
+
handleOpen,
|
|
1106
|
+
handleClose
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
const _hoisted_1$2 = { class: "dropdown-select" };
|
|
1110
|
+
const _hoisted_2$2 = { class: "dropdown-title" };
|
|
1111
|
+
const _hoisted_3$2 = { class: "dropdown-text" };
|
|
1112
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1113
|
+
__name: "index",
|
|
1114
|
+
props: {
|
|
1115
|
+
modelValue: {},
|
|
1116
|
+
iconName: { default: "arrow-down" },
|
|
1117
|
+
options: {}
|
|
1118
|
+
},
|
|
1119
|
+
emits: ["update:modelValue", "change"],
|
|
1120
|
+
setup(__props, { emit: __emit }) {
|
|
1121
|
+
const props = __props;
|
|
1122
|
+
const emit = __emit;
|
|
1123
|
+
const { displayText, internalValue, handleChange, handleOpen, handleClose } = useDropdownSelect(props, emit);
|
|
1124
|
+
const isOpen = ref(false);
|
|
1125
|
+
const selectedIndex = computed(() => {
|
|
1126
|
+
if (!props.options || !props.options.length)
|
|
1127
|
+
return 0;
|
|
1128
|
+
return props.options.findIndex((opt) => opt.value === internalValue.value);
|
|
1129
|
+
});
|
|
1130
|
+
function togglePicker() {
|
|
1131
|
+
isOpen.value = !isOpen.value;
|
|
1132
|
+
if (isOpen.value) {
|
|
1133
|
+
handleOpen();
|
|
1134
|
+
} else {
|
|
1135
|
+
handleClose();
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
function onPickerChange(e) {
|
|
1139
|
+
const index2 = e.detail.value;
|
|
1140
|
+
const selectedOption = props.options[index2];
|
|
1141
|
+
handleChange(selectedOption.value);
|
|
1142
|
+
isOpen.value = false;
|
|
1143
|
+
handleClose();
|
|
1144
|
+
}
|
|
1145
|
+
function onPickerCancel() {
|
|
1146
|
+
isOpen.value = false;
|
|
1147
|
+
handleClose();
|
|
1148
|
+
}
|
|
1149
|
+
return (_ctx, _cache) => {
|
|
1150
|
+
const _component_picker = resolveComponent("picker");
|
|
1151
|
+
return openBlock(), createElementBlock("view", _hoisted_1$2, [
|
|
1152
|
+
createElementVNode("view", {
|
|
1153
|
+
class: "dropdown-trigger",
|
|
1154
|
+
onTap: togglePicker
|
|
1155
|
+
}, [
|
|
1156
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ text: unref(displayText) })), () => [
|
|
1157
|
+
createElementVNode("view", _hoisted_2$2, [
|
|
1158
|
+
createElementVNode("text", _hoisted_3$2, toDisplayString(unref(displayText)), 1),
|
|
1159
|
+
createElementVNode("text", {
|
|
1160
|
+
class: normalizeClass(["dropdown-icon", { "is-active": isOpen.value }])
|
|
1161
|
+
}, [
|
|
1162
|
+
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
1163
|
+
createElementVNode("view", {
|
|
1164
|
+
class: normalizeClass(["uni-icon", _ctx.iconName])
|
|
1165
|
+
}, null, 2)
|
|
1166
|
+
])
|
|
1167
|
+
], 2)
|
|
1168
|
+
])
|
|
1169
|
+
])
|
|
1170
|
+
], 32),
|
|
1171
|
+
isOpen.value ? (openBlock(), createBlock(_component_picker, {
|
|
1172
|
+
key: 0,
|
|
1173
|
+
mode: "selector",
|
|
1174
|
+
range: _ctx.options,
|
|
1175
|
+
"range-key": "text",
|
|
1176
|
+
value: selectedIndex.value,
|
|
1177
|
+
class: "dropdown-picker",
|
|
1178
|
+
onChange: onPickerChange,
|
|
1179
|
+
onCancel: onPickerCancel
|
|
1180
|
+
}, null, 8, ["range", "value"])) : createCommentVNode("", true)
|
|
1181
|
+
]);
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
function useDropdownWithBadge(props) {
|
|
1186
|
+
const hasBadge = computed(() => {
|
|
1187
|
+
return props.hideBadge(props.modelValue);
|
|
1188
|
+
});
|
|
1189
|
+
return { hasBadge };
|
|
1190
|
+
}
|
|
1191
|
+
const _hoisted_1$1 = { class: "dropdown-title" };
|
|
1192
|
+
const _hoisted_2$1 = { class: "dropdown-text" };
|
|
1193
|
+
const _hoisted_3$1 = { class: "dropdown-icon" };
|
|
1194
|
+
const _hoisted_4$1 = { class: "dropdown-with-badge__dot" };
|
|
1195
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1196
|
+
__name: "index",
|
|
1197
|
+
props: {
|
|
1198
|
+
hideBadge: { type: Function, default: (modelValue) => modelValue === "" || modelValue === null || modelValue === void 0 }
|
|
1199
|
+
},
|
|
1200
|
+
emits: ["update:modelValue", "change"],
|
|
1201
|
+
setup(__props, { emit: __emit }) {
|
|
1202
|
+
const props = __props;
|
|
1203
|
+
const emit = __emit;
|
|
1204
|
+
const { hasBadge } = useDropdownWithBadge(props);
|
|
1205
|
+
return (_ctx, _cache) => {
|
|
1206
|
+
return openBlock(), createBlock(unref(_sfc_main$2), mergeProps({ modelValue: _ctx.modelValue, options: _ctx.options }, { class: "dropdown-with-badge" }, toHandlers(emit)), {
|
|
1207
|
+
default: withCtx(({ text }) => [
|
|
1208
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ text })), () => [
|
|
1209
|
+
createElementVNode("view", _hoisted_1$1, [
|
|
1210
|
+
createElementVNode("text", _hoisted_2$1, toDisplayString(text), 1),
|
|
1211
|
+
createElementVNode("text", _hoisted_3$1, [
|
|
1212
|
+
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
1213
|
+
createElementVNode("view", {
|
|
1214
|
+
class: normalizeClass(["uni-icon", _ctx.iconName])
|
|
1215
|
+
}, null, 2)
|
|
1216
|
+
])
|
|
1217
|
+
])
|
|
1218
|
+
]),
|
|
1219
|
+
withDirectives(createElementVNode("text", _hoisted_4$1, null, 512), [
|
|
1220
|
+
[vShow, !unref(hasBadge)]
|
|
1221
|
+
])
|
|
1222
|
+
])
|
|
1223
|
+
]),
|
|
1224
|
+
_: 3
|
|
1225
|
+
}, 16);
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
function useHasBadge(model) {
|
|
1230
|
+
if (!model) {
|
|
1231
|
+
return computed(() => false);
|
|
1232
|
+
}
|
|
1233
|
+
if (typeof model === "function") {
|
|
1234
|
+
return computed(() => model());
|
|
1235
|
+
}
|
|
1236
|
+
if (isRef(model)) {
|
|
1237
|
+
return computed(() => {
|
|
1238
|
+
if (!model.value)
|
|
1239
|
+
return false;
|
|
1240
|
+
const obj = model.value;
|
|
1241
|
+
for (const key in obj) {
|
|
1242
|
+
if (obj[key]) {
|
|
1243
|
+
return true;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return false;
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
return computed(() => {
|
|
1250
|
+
for (const key in model) {
|
|
1251
|
+
const val = model[key];
|
|
1252
|
+
if (val) {
|
|
1253
|
+
return true;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
return false;
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
function useFilterDrawer(props, emit) {
|
|
1260
|
+
const visible = ref(false);
|
|
1261
|
+
const hasBadge = useHasBadge(props.modelValue);
|
|
1262
|
+
const openDrawer = () => {
|
|
1263
|
+
visible.value = true;
|
|
1264
|
+
};
|
|
1265
|
+
const closeDrawer = () => {
|
|
1266
|
+
visible.value = false;
|
|
1267
|
+
};
|
|
1268
|
+
const resetDrawer = () => {
|
|
1269
|
+
emit("reset");
|
|
1270
|
+
closeDrawer();
|
|
1271
|
+
};
|
|
1272
|
+
const queryDrawer = () => {
|
|
1273
|
+
emit("query");
|
|
1274
|
+
closeDrawer();
|
|
1275
|
+
};
|
|
1276
|
+
return {
|
|
1277
|
+
visible,
|
|
1278
|
+
openDrawer,
|
|
1279
|
+
closeDrawer,
|
|
1280
|
+
resetDrawer,
|
|
1281
|
+
queryDrawer,
|
|
1282
|
+
hasBadge
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
const _hoisted_1 = /* @__PURE__ */ createElementVNode("view", { class: "uni-icon icon-filter-o" }, null, -1);
|
|
1286
|
+
const _hoisted_2 = {
|
|
1287
|
+
key: 0,
|
|
1288
|
+
class: "filter-drawer__badge-dot"
|
|
1289
|
+
};
|
|
1290
|
+
const _hoisted_3 = {
|
|
1291
|
+
key: 1,
|
|
1292
|
+
class: "filter-drawer__popup",
|
|
1293
|
+
style: { height: "100vh", width: "100vw" }
|
|
1294
|
+
};
|
|
1295
|
+
const _hoisted_4 = { class: "filter-drawer" };
|
|
1296
|
+
const _hoisted_5 = { class: "filter-drawer__header" };
|
|
1297
|
+
const _hoisted_6 = /* @__PURE__ */ createElementVNode("text", { class: "filter-drawer__title" }, "筛选", -1);
|
|
1298
|
+
const _hoisted_7 = { class: "filter-drawer__body" };
|
|
1299
|
+
const _hoisted_8 = { class: "filter-drawer__footer" };
|
|
1300
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1301
|
+
__name: "index",
|
|
1302
|
+
props: {
|
|
1303
|
+
hasBadge: { type: Boolean, default: false },
|
|
1304
|
+
modelValue: {}
|
|
1305
|
+
},
|
|
1306
|
+
emits: ["reset", "query"],
|
|
1307
|
+
setup(__props, { emit: __emit }) {
|
|
1308
|
+
const props = __props;
|
|
1309
|
+
const emit = __emit;
|
|
1310
|
+
const { visible, openDrawer, closeDrawer, resetDrawer, queryDrawer, hasBadge } = useFilterDrawer(props, emit);
|
|
1311
|
+
return (_ctx, _cache) => {
|
|
1312
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
1313
|
+
createElementVNode("view", {
|
|
1314
|
+
class: "filter-drawer__trigger",
|
|
1315
|
+
onClick: _cache[0] || (_cache[0] = //@ts-ignore
|
|
1316
|
+
(...args) => unref(openDrawer) && unref(openDrawer)(...args))
|
|
1317
|
+
}, [
|
|
1318
|
+
renderSlot(_ctx.$slots, "trigger", {}, () => [
|
|
1319
|
+
_hoisted_1
|
|
1320
|
+
]),
|
|
1321
|
+
unref(hasBadge) ? (openBlock(), createElementBlock("text", _hoisted_2)) : createCommentVNode("", true)
|
|
1322
|
+
]),
|
|
1323
|
+
unref(visible) ? (openBlock(), createElementBlock("view", {
|
|
1324
|
+
key: 0,
|
|
1325
|
+
class: "filter-drawer__popup-mask",
|
|
1326
|
+
onClick: _cache[1] || (_cache[1] = //@ts-ignore
|
|
1327
|
+
(...args) => unref(closeDrawer) && unref(closeDrawer)(...args))
|
|
1328
|
+
})) : createCommentVNode("", true),
|
|
1329
|
+
unref(visible) ? (openBlock(), createElementBlock("view", _hoisted_3, [
|
|
1330
|
+
createElementVNode("view", {
|
|
1331
|
+
class: "filter-drawer__close",
|
|
1332
|
+
onClick: _cache[2] || (_cache[2] = //@ts-ignore
|
|
1333
|
+
(...args) => unref(closeDrawer) && unref(closeDrawer)(...args))
|
|
1334
|
+
}, " × "),
|
|
1335
|
+
createElementVNode("view", _hoisted_4, [
|
|
1336
|
+
createElementVNode("view", _hoisted_5, [
|
|
1337
|
+
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
1338
|
+
_hoisted_6
|
|
1339
|
+
])
|
|
1340
|
+
]),
|
|
1341
|
+
createElementVNode("view", _hoisted_7, [
|
|
1342
|
+
renderSlot(_ctx.$slots, "default")
|
|
1343
|
+
]),
|
|
1344
|
+
createElementVNode("view", _hoisted_8, [
|
|
1345
|
+
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
1346
|
+
createElementVNode("view", {
|
|
1347
|
+
class: "filter-drawer__button filter-drawer__button--plain",
|
|
1348
|
+
onClick: _cache[3] || (_cache[3] = //@ts-ignore
|
|
1349
|
+
(...args) => unref(resetDrawer) && unref(resetDrawer)(...args))
|
|
1350
|
+
}, " 重置条件 "),
|
|
1351
|
+
createElementVNode("view", {
|
|
1352
|
+
class: "filter-drawer__button",
|
|
1353
|
+
onClick: _cache[4] || (_cache[4] = //@ts-ignore
|
|
1354
|
+
(...args) => unref(queryDrawer) && unref(queryDrawer)(...args))
|
|
1355
|
+
}, " 查询 ")
|
|
1356
|
+
])
|
|
1357
|
+
])
|
|
1358
|
+
])
|
|
1359
|
+
])) : createCommentVNode("", true)
|
|
1360
|
+
], 64);
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
export {
|
|
1365
|
+
index$7 as Button,
|
|
1366
|
+
index$6 as Dialog,
|
|
1367
|
+
index$5 as Divider,
|
|
1368
|
+
_sfc_main$2 as DropdownSelect,
|
|
1369
|
+
_sfc_main$1 as DropdownWithBadge,
|
|
1370
|
+
_sfc_main as FilterDrawer,
|
|
1371
|
+
index$1 as InfiniteScroll,
|
|
1372
|
+
index$4 as Popup,
|
|
1373
|
+
index as PullRefresh,
|
|
1374
|
+
index$2 as Swiper,
|
|
1375
|
+
index$3 as Toast,
|
|
1376
|
+
useDropdownSelect,
|
|
1377
|
+
useDropdownWithBadge,
|
|
1378
|
+
useFilterDrawer
|
|
1379
|
+
};
|
|
1380
|
+
//# sourceMappingURL=index.es.js.map
|