@wetspace/pro-components
Version:
::: tip 基本介绍
39 lines (38 loc) • 1.24 kB
JavaScript
import { defineComponent as a, inject as c, useSlots as f, shallowRef as p, computed as h, onMounted as v, onUnmounted as g, createVNode as l, Fragment as b } from "vue";
import { SymbolState as w } from "./symbol.mjs";
import { wetGuideItemProps as j } from "./types.mjs";
import { useElementBounding as y } from "../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.4.2_/node_modules/@vueuse/core/index.mjs";
const I = /* @__PURE__ */ a({
name: "WetGuideItem",
props: j,
setup(e) {
const i = c(w), t = f(), n = p(), {
height: d,
left: r,
top: u,
width: m
} = y(n);
let o;
const s = h(() => ({
width: m.value,
left: r.value,
top: u.value,
height: d.value,
description: e.description || t.description,
title: e.title,
order: e.order ?? o,
placement: e.placement
}));
return v(() => {
o = Object.values(i).length, i[o] = s;
}), g(() => {
i[o] = null;
}), () => l(b, null, [t.default && t.default(), l("div", {
ref: n,
style: "visibility:hidden;width: fit-content;height: fit-content;position: absolute;z-index:-1"
}, [t.default && t.default()])]);
}
});
export {
I as default
};