UNPKG

various-ui

Version:

This is a test version of the Vue 3 component library

99 lines (96 loc) 3.35 kB
import { defineComponent, nextTick, onBeforeUnmount, onMounted, openBlock, createElementBlock, normalizeClass, createCommentVNode, unref, withModifiers, createElementVNode, mergeProps, renderSlot } from 'vue'; import { UiSimplebarPropsOption, UiSimplebarEmits } from './src/component.mjs'; import { useComposable } from './src/composable.mjs'; const _hoisted_1 = { class: "ui-simplebar-content" }; const __default__ = defineComponent({ name: "UiSimplebar" }); var _sfc_main = /* @__PURE__ */ defineComponent({ ...__default__, props: UiSimplebarPropsOption, emits: UiSimplebarEmits, setup(__props, { expose: __expose, emit: __emit }) { const emits = __emit; const define = __props; const { refs, vars, nodes, binds, methods } = useComposable(define, emits); const { slideway, container } = nodes; const { visible } = refs; const move = (top) => { nextTick(() => { var _a; (_a = container.value) == null ? void 0 : _a.scrollTo({ top, behavior: "smooth" }); }); }; onBeforeUnmount(() => { var _a; return (_a = vars.observer) == null ? void 0 : _a.disconnect(); }); onMounted(() => { var _a; const node = (_a = container.value) == null ? void 0 : _a.querySelector(".ui-simplebar-content"); if (node) { vars.observer = new ResizeObserver(() => methods.init()); vars.observer.observe(node); } }); ; __expose({ move }); return (_ctx, _cache) => { return openBlock(), createElementBlock( "div", { class: normalizeClass(["ui-simplebar", define.trigger == "Hover" ? "ui-simplebar-hover" : ""]) }, [ createCommentVNode(" * \u8F68\u9053 "), unref(visible) ? (openBlock(), createElementBlock( "div", { key: 0, class: "ui-simplebar-slideway", ref_key: "slideway", ref: slideway, onMousedown: _cache[1] || (_cache[1] = withModifiers( //@ts-ignore (...args) => unref(methods).move && unref(methods).move(...args), ["self"] )) }, [ createElementVNode( "div", mergeProps({ class: "ui-simplebar-bar" }, unref(binds).bar, { onMousedown: _cache[0] || (_cache[0] = //@ts-ignore (...args) => unref(methods).drag && unref(methods).drag(...args)) }), null, 16 /* FULL_PROPS */ ) ], 544 /* NEED_HYDRATION, NEED_PATCH */ )) : createCommentVNode("v-if", true), createCommentVNode(" * \u5185\u5BB9 "), createElementVNode( "div", mergeProps({ class: "ui-simplebar-container", ref_key: "container", ref: container }, unref(binds).container), [ createElementVNode("div", _hoisted_1, [ renderSlot(_ctx.$slots, "default") ]) ], 16 /* FULL_PROPS */ ) ], 2 /* CLASS */ ); }; } }); export { _sfc_main as default }; //# sourceMappingURL=index.vue2.mjs.map