hongluan-ui
Version:
Hongluan Component Library for Vue 3
56 lines (53 loc) • 2.05 kB
JavaScript
import { defineComponent, computed, openBlock, createBlock, Transition, withCtx, unref, createElementBlock, normalizeStyle, normalizeClass, withModifiers, renderSlot, createVNode, createCommentVNode } from 'vue';
import { HlIcon } from '../../icon/index.mjs';
import '../../system-icon/index.mjs';
import '../../../hooks/index.mjs';
import { backtopProps, backtopEmits } from './backtop.mjs';
import { useBackTop } from './use-backtop.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import SystemArrowUp from '../../system-icon/src/arrow-up.mjs';
const COMPONENT_NAME = "Backtop";
const __default__ = defineComponent({
name: COMPONENT_NAME
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: backtopProps,
emits: backtopEmits,
setup(__props, { emit }) {
const props = __props;
const { namespace } = useNamespace("backtop");
const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME);
const backTopStyle = computed(() => ({
right: `${props.right}px`,
bottom: `${props.bottom}px`
}));
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, { name: "fade" }, {
default: withCtx(() => [
unref(visible) ? (openBlock(), createElementBlock("div", {
key: 0,
style: normalizeStyle(unref(backTopStyle)),
class: normalizeClass(unref(namespace)),
onClick: withModifiers(unref(handleClick), ["stop"])
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createVNode(unref(HlIcon), {
name: "chevronsTop",
opacity: 0
}, {
default: withCtx(() => [
createVNode(unref(SystemArrowUp))
]),
_: 1
})
])
], 14, ["onClick"])) : createCommentVNode("v-if", true)
]),
_: 3
});
};
}
});
export { _sfc_main as default };
//# sourceMappingURL=backtop2.mjs.map