UNPKG

tav-ui

Version:
77 lines (72 loc) 2.27 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var useScrollTo = require('../../../hooks/event/useScrollTo2.js'); var index = require('../../scrollbar/index2.js'); var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js'); const _sfc_main = vue.defineComponent({ name: "TaContainerScroll", components: { Scrollbar: index.TaScrollbar }, setup() { const scrollbarRef = vue.ref(null); function scrollTo(to, duration = 500) { const scrollbar = vue.unref(scrollbarRef); if (!scrollbar) return; vue.nextTick(() => { const wrap = vue.unref(scrollbar.wrap); if (!wrap) return; const { start } = useScrollTo.useScrollTo({ el: wrap, to, duration }); start(); }); } function getScrollWrap() { const scrollbar = vue.unref(scrollbarRef); if (!scrollbar) return null; return scrollbar.wrap; } function scrollBottom() { const scrollbar = vue.unref(scrollbarRef); if (!scrollbar) return; vue.nextTick(() => { const wrap = vue.unref(scrollbar.wrap); if (!wrap) return; const scrollHeight = wrap.scrollHeight; const { start } = useScrollTo.useScrollTo({ el: wrap, to: scrollHeight }); start(); }); } return { scrollbarRef, scrollTo, scrollBottom, getScrollWrap }; } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_Scrollbar = vue.resolveComponent("Scrollbar"); return vue.openBlock(), vue.createBlock(_component_Scrollbar, vue.mergeProps({ ref: "scrollbarRef", "container-class": "scroll-container" }, _ctx.$attrs), { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16); } var ContainerScroll = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/tav-ui/tav-ui/packages/components/container-scroll/src/container-scroll.vue"]]); exports["default"] = ContainerScroll; //# sourceMappingURL=container-scroll2.js.map