st-common-ui-vue3
Version:
小尾巴通用 Vue3 UI 组件库
30 lines (29 loc) • 957 B
JavaScript
import { defineComponent as n, ref as h, watch as l, openBlock as o, createElementBlock as r, renderSlot as s } from "vue";
import { useElementSize as c, useWindowSize as f } from "../../node_modules/.pnpm/@vueuse_core@12.0.0_typescript@5.6.2/node_modules/@vueuse/core/index.js";
const w = /* @__PURE__ */ n({
name: "StWatchWidth",
__name: "StWatchWidth",
props: {
strategy: { default: "self" },
widthChangeHandler: { type: Function, default: () => {
} },
immediate: { type: Boolean, default: !0 }
},
setup(t) {
const a = h(null), { width: i } = c(a), { width: d } = f();
return l(
() => t.strategy === "self" ? i.value : d.value,
(e) => t.widthChangeHandler(e),
{ immediate: t.immediate }
), (e, m) => (o(), r("div", {
ref_key: "stWatchWidthRef",
ref: a,
class: "st-watch-width"
}, [
s(e.$slots, "default", {}, void 0, !0)
], 512));
}
});
export {
w as default
};