UNPKG

quick-admin-vue3-core

Version:

以快(计算机执行效率、开发效率)为核心的后台管理系统开发模板

120 lines (119 loc) 4.09 kB
import { defineComponent as I, ref as a, onMounted as P, resolveComponent as m, createBlock as Y, openBlock as h, withCtx as v, createElementVNode as n, createElementBlock as w, createCommentVNode as D, renderSlot as j, normalizeClass as q, toDisplayString as T, normalizeStyle as H, unref as u, createVNode as i } from "vue"; import { y as M } from "./platform-DsTwHxm6.js"; import { l as b } from "./index-D-KS7NhM.js"; import { _ as A } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const F = { key: 0, class: "f-c-c load-tips" }, G = { class: "text" }, J = { key: 1, class: "f-c-c load-tips" }, K = { class: "text" }, k = 2e3, L = /* @__PURE__ */ I({ __name: "BaseScroll", props: { topDistance: { default: 150 }, bottomDistance: { default: 150 }, loading: { type: Boolean }, paddingTop: { default: 0 }, paddingBottom: { default: 0 }, debounceDelay: { default: 300 }, noMoreTips: { default: "没有更多啦~" }, topHasMore: { type: Boolean, default: !0 }, loadTips: { default: "玩命加载中…" }, emptyTips: { default: "换个姿势搜搜看~" } }, emits: ["reachTop", "reachBottom"], setup(C, { expose: E, emit: R }) { let t = null; const S = C, _ = R, c = a(!1), V = a(!1), o = a(null), p = a(!1), g = a(!1); P(() => { var l; if (!((l = o == null ? void 0 : o.value) != null && l.wrapRef)) return; const { scrollHeight: e, clientHeight: s } = o.value.wrapRef; V.value = e > s; }); function $(e) { var B; if (!((B = o == null ? void 0 : o.value) != null && B.wrapRef)) return; const { scrollTop: s, scrollHeight: l, clientHeight: r } = o.value.wrapRef; if (l <= r) return; const { deltaY: d } = e; c.value = d > 0; const { topDistance: N, bottomDistance: z, debounceDelay: y } = S; if (c.value) { if (s + r + z + 1 >= l) { t && clearTimeout(t); const f = !t; t = setTimeout(function() { t = null; }, y), f && (_("reachBottom", e), g.value = !0, setTimeout(() => { g.value = !1; }, k)); } return; } if (s <= N) { t && clearTimeout(t); const f = !t; t = setTimeout(function() { t = null; }, y), f && (_("reachTop", e), p.value = !0, setTimeout(() => { p.value = !1; }, k)); } } return E({ //滚动到底部 scrollToBottom() { const { scrollTop: e, scrollHeight: s, clientHeight: l } = o.value.wrapRef; s <= l || o.value.wrapRef.scrollTo(0, s); } }), (e, s) => { const l = m("el-icon"), r = m("BaseEmpty"), d = m("el-scrollbar"); return h(), Y(d, { onMousewheelPassive: $, class: "base-scroll", ref_key: "baseScrollRef", ref: o }, { default: v(() => [ n("div", { class: q(["no-more-tips top f-c-c", { show: !e.topHasMore && p.value }]) }, T(e.noMoreTips), 3), n("div", { class: "space top", style: H(`height: ${u(M)(e.paddingTop)};`) }, null, 4), e.loading && !c.value ? (h(), w("div", F, [ i(l, { class: "rotate" }, { default: v(() => [ i(u(b)) ]), _: 1 }), n("span", G, T(e.loadTips), 1) ])) : D("", !0), j(e.$slots, "default", {}, () => [ i(r, { description: e.emptyTips }, null, 8, ["description"]) ], !0), n("div", { style: H(`height: ${u(M)(e.paddingBottom)};`) }, null, 4), e.loading && c.value ? (h(), w("div", J, [ i(l, { class: "rotate" }, { default: v(() => [ i(u(b)) ]), _: 1 }), n("span", K, T(e.loadTips), 1) ])) : D("", !0) ]), _: 3 }, 512); }; } }), X = /* @__PURE__ */ A(L, [["__scopeId", "data-v-d330bc2f"]]); export { X as default };