@vuesax-alpha/nightly
Version:
A Component Library for Vue 3
55 lines (52 loc) • 1.84 kB
JavaScript
import { defineComponent, ref, openBlock, createElementBlock, Fragment, createVNode, normalizeStyle } from 'vue';
import { GAP } from './util.mjs';
import Thumb from './thumb2.mjs';
import { barProps } from './bar.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
const _sfc_main = defineComponent({
__name: "bar",
props: barProps,
setup(__props, { expose: __expose }) {
const props = __props;
const moveX = ref(0);
const moveY = ref(0);
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;
}
};
__expose({
handleScroll
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock(
Fragment,
null,
[
createVNode(Thumb, {
move: moveX.value,
ratio: _ctx.ratioX,
size: _ctx.width,
always: _ctx.always,
style: normalizeStyle(`height: ${_ctx.thickness}px`)
}, null, 8, ["move", "ratio", "size", "always", "style"]),
createVNode(Thumb, {
move: moveY.value,
ratio: _ctx.ratioY,
size: _ctx.height,
vertical: "",
always: _ctx.always,
style: normalizeStyle(`width: ${_ctx.thickness}px`)
}, null, 8, ["move", "ratio", "size", "always", "style"])
],
64
);
};
}
});
var Bar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/vuesax-alpha/vuesax-alpha/packages/components/scrollbar/src/bar.vue"]]);
export { Bar as default };
//# sourceMappingURL=bar2.mjs.map