UNPKG

mine-h5-ui

Version:

一款轻量级、模块化基于 Vue3.x 的 H5 前端 UI 组件库 👍

39 lines (38 loc) 1.26 kB
import { defineComponent as B, useAttrs as b, watch as N, onUnmounted as h, openBlock as y, createElementBlock as C, mergeProps as T, unref as e, renderSlot as _ } from "vue"; import { useHandler as v } from "./hooks.js"; import { useBind as w } from "../MeComposable/useBind/index.js"; import { useUtils as x } from "../MeComposable/useUtils/index.js"; const E = /* @__PURE__ */ B({ name: "MeFloatButton", __name: "index", props: { type: { default: "default" }, scrollTop: { default: 0 }, scrollNode: { default: () => document.body } }, emits: ["click"], setup(s, { emit: c }) { const d = c, i = b(), o = s, { addBind: m, removeBind: u } = w(), { throttle: a } = x(), { visible: p, onClick: r, onScroll: f } = v(o, d), l = a(f, 100); return N( () => o.scrollNode, (t) => { o.type === "backTop" && t && m(t, "scroll", l); }, { immediate: !0 } ), h(() => { o.scrollNode && u(o.scrollNode, "scroll", l); }), (t, n) => (y(), C("div", T({ class: ["me-float-button", { show: e(p) }] }, e(i), { onClick: n[0] || (n[0] = //@ts-ignore (...k) => e(r) && e(r)(...k)) }), [ _(t.$slots, "default") ], 16)); } }); export { E as default };