UNPKG

@huyuchen/visual

Version:

## 组件环境

97 lines (96 loc) 3.28 kB
import { useAttrs as I, useSlots as $, ref as c, computed as j, onMounted as w, onUnmounted as z, openBlock as s, createBlock as g, unref as r, mergeProps as B, createSlots as N, withCtx as u, createElementBlock as i, Fragment as m, renderList as _, renderSlot as b, createVNode as P, createTextVNode as M, toDisplayString as U, pushScopeId as V, popScopeId as A, createElementVNode as h } from "vue"; import { ElSelect as H, ElOption as S } from "element-plus"; import "element-plus/theme-chalk/el-select.css"; import "element-plus/theme-chalk/el-scrollbar.css"; import "./HuSelectPage.vue2.js"; import C from "../_virtual/_plugin-vue_export-helper.js"; const y = (o) => (V("data-v-97e3eb66"), o = o(), A(), o), D = { key: 0, class: "hu_select_loading" }, F = /* @__PURE__ */ y(() => /* @__PURE__ */ h("div", { class: "loader" }, null, -1)), L = /* @__PURE__ */ y(() => /* @__PURE__ */ h("span", null, "加载中", -1)), T = [ F, L ], q = Object.assign({ name: "HuSelectPage" // inheritAttrs: false, }, { __name: "HuSelectPage", props: { options: Array, loading: { // 加载loading的判断--避免重复加载 type: Boolean, default: !1 }, pagesOptions: { type: Object, default: () => ({ current: "current", pageSize: "pageSize", total: "total" }) }, pages: { type: Object, default: () => ({ current: 1, pageSize: 10, total: 0 }) } }, emits: ["pullUp"], setup(o, { emit: O }) { const t = o, k = O, x = I(), E = $(), d = c([]), v = j(() => t.pages[t.pagesOptions.total] >= (t.pages[t.pagesOptions.current] - 1) * t.pages[t.pagesOptions.pageSize]), a = c(), p = c(); return w(() => { var e; if (d.value = Object.keys(E).filter((n) => n !== "default"), !a.value) return; const l = (n) => { t.loading || !v.value || !n[0].isIntersecting || k("pullUp"); }, f = { root: (e = a.value.$el.parentElement) == null ? void 0 : e.parentElement, rootMargin: "0px 0px 0px 0px" }; p.value = new IntersectionObserver(l, f), p.value.observe(a.value.$el); }), z(() => { var l; a.value && ((l = p.value) == null || l.unobserve(a.value.$el)); }), (l, f) => (s(), g(r(H), B({ style: { width: "240px" } }, r(x)), N({ default: u(() => [ (s(!0), i(m, null, _(o.options, (e) => (s(), g(r(S), { key: e.value, label: e.label, value: e.value }, { default: u(() => [ b(l.$slots, "default", { label: e.label, value: e.value }, void 0, !0) ]), _: 2 }, 1032, ["label", "value"]))), 128)), P(r(S), { ref_key: "el", ref: a, value: "" }, { default: u(() => [ v.value ? (s(), i("div", D, T)) : (s(), i(m, { key: 1 }, [ M(U("到底了~")) ], 64)) ]), _: 1 }, 512) ]), _: 2 }, [ _(d.value, (e, n) => ({ name: e, fn: u(() => [ b(l.$slots, e, {}, void 0, !0) ]) })) ]), 1040)); } }), X = /* @__PURE__ */ C(q, [["__scopeId", "data-v-97e3eb66"]]); export { X as default };