UNPKG

tyh-ui2

Version:

The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.

36 lines (35 loc) 977 B
import { defineComponent as l, ref as a, onMounted as i, withDirectives as p, openBlock as u, createElementBlock as m, normalizeStyle as d, renderSlot as f, vShow as h } from "vue"; import { Props as v } from "./index2.js"; const T = l({ name: "TyhBackTop" }), w = /* @__PURE__ */ l({ ...T, props: v, setup(r) { const t = r, e = a(!1), n = () => { let o = null; return () => { o !== null && clearTimeout(o), o = setTimeout(() => { document.documentElement.scrollTop > t.beyond ? e.value = !0 : e.value = !1; }, 188); }; }, s = () => { window.scrollTo({ top: 0, behavior: t.behavior }); }; return i(() => addEventListener("scroll", n())), (o, c) => p((u(), m("div", { class: "tyh-back-top", style: d({ bottom: o.bottom, right: o.right }), onClick: s }, [ f(o.$slots, "default") ], 4)), [ [h, e.value] ]); } }); export { w as default };