UNPKG

element-plus

Version:

A Component Library for Vue 3

52 lines (49 loc) 1.67 kB
import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, Fragment, createVNode } from 'vue'; import Thumb from './thumb2.mjs'; import { barProps } from './bar.mjs'; import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs'; const _sfc_main = defineComponent({ components: { Thumb }, props: barProps, setup(props) { const moveX = ref(0); const moveY = ref(0); const GAP = 4; const handleScroll = (wrap) => { if (wrap) { const offsetHeight = wrap.offsetHeight - GAP; const offsetWidth = wrap.offsetWidth - GAP; moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY; moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX; } }; return { handleScroll, moveX, moveY }; } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_thumb = resolveComponent("thumb"); return openBlock(), createElementBlock(Fragment, null, [ createVNode(_component_thumb, { move: _ctx.moveX, ratio: _ctx.ratioX, size: _ctx.width, always: _ctx.always }, null, 8, ["move", "ratio", "size", "always"]), createVNode(_component_thumb, { move: _ctx.moveY, ratio: _ctx.ratioY, size: _ctx.height, vertical: "", always: _ctx.always }, null, 8, ["move", "ratio", "size", "always"]) ], 64); } var Bar = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]); export { Bar as default }; //# sourceMappingURL=bar2.mjs.map