fbaae1da83b153bcfff8939fc3628c0ad2f0a5cffcc3286a91b0f00451ecbe9ff6d80e6d00dfd84812e7e13ce26ea94e85fb8249ced1a1e604998e86fe196e 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { defineComponent, computed, openBlock, createBlock, Transition, unref, withCtx, createElementBlock, normalizeStyle, normalizeClass, withModifiers, renderSlot, createVNode, createCommentVNode } from 'vue';
  2. import { ElIcon } from '../../icon/index.mjs';
  3. import { CaretTop } from '@element-plus/icons-vue';
  4. import { backtopProps, backtopEmits } from './backtop.mjs';
  5. import { useBackTop } from './use-backtop.mjs';
  6. import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
  7. import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
  8. const COMPONENT_NAME = "ElBacktop";
  9. const __default__ = defineComponent({
  10. name: COMPONENT_NAME
  11. });
  12. const _sfc_main = /* @__PURE__ */ defineComponent({
  13. ...__default__,
  14. props: backtopProps,
  15. emits: backtopEmits,
  16. setup(__props, { emit }) {
  17. const props = __props;
  18. const ns = useNamespace("backtop");
  19. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME);
  20. const backTopStyle = computed(() => ({
  21. right: `${props.right}px`,
  22. bottom: `${props.bottom}px`
  23. }));
  24. return (_ctx, _cache) => {
  25. return openBlock(), createBlock(Transition, {
  26. name: `${unref(ns).namespace.value}-fade-in`
  27. }, {
  28. default: withCtx(() => [
  29. unref(visible) ? (openBlock(), createElementBlock("div", {
  30. key: 0,
  31. style: normalizeStyle(unref(backTopStyle)),
  32. class: normalizeClass(unref(ns).b()),
  33. onClick: withModifiers(unref(handleClick), ["stop"])
  34. }, [
  35. renderSlot(_ctx.$slots, "default", {}, () => [
  36. createVNode(unref(ElIcon), {
  37. class: normalizeClass(unref(ns).e("icon"))
  38. }, {
  39. default: withCtx(() => [
  40. createVNode(unref(CaretTop))
  41. ]),
  42. _: 1
  43. }, 8, ["class"])
  44. ])
  45. ], 14, ["onClick"])) : createCommentVNode("v-if", true)
  46. ]),
  47. _: 3
  48. }, 8, ["name"]);
  49. };
  50. }
  51. });
  52. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "backtop.vue"]]);
  53. export { Backtop as default };
  54. //# sourceMappingURL=backtop2.mjs.map