UNPKG

vuux

Version:

Vue3 Nuxt3 Nuxt4 组件库

54 lines (53 loc) 1.49 kB
import { defineComponent as E, useTemplateRef as n, ref as S, provide as _, reactive as b, createElementBlock as w, openBlock as B, createElementVNode as k, createVNode as x, unref as r, normalizeStyle as z, renderSlot as v } from "vue"; import W from "./bar.vue.mjs"; import { useScrollBar as g } from "./hook/useScrollBar.mjs"; const V = /* @__PURE__ */ E({ name: "ScrollBar", __name: "index", props: { height: {}, maxHeight: {}, minSize: { default: 20 }, always: { type: Boolean, default: !1 } }, emits: ["scroll"], setup(c, { expose: i, emit: m }) { const e = c, p = m, o = n("scrollbarEl"), l = n("scrollWrapEl"), a = S(null), { wrapStyle: f, update: d, scroll: s } = g(e, l, a, p); return _( "scrollBarContext", b({ scrollbarEl: o, scrollWrapEl: l }) ), i({ /** * 更新滚动条 */ update: d }), (u, t) => (B(), w("div", { ref_key: "scrollbarEl", ref: o, class: "app-scrollbar" }, [ k("div", { ref_key: "scrollWrapEl", ref: l, class: "scroll-wrap", style: z(r(f)), onScroll: t[0] || (t[0] = //@ts-ignore (...y) => r(s) && r(s)(...y)) }, [ v(u.$slots, "default") ], 36), x(W, { ref_key: "barEl", ref: a, always: e.always, "min-size": e.minSize ?? 20 }, null, 8, ["always", "min-size"]) ], 512)); } }); export { V as default };