st-common-ui-vue3
Version:
小尾巴通用 Vue3 UI 组件库
30 lines (29 loc) • 670 B
JavaScript
import { useParentElement as l } from "../../node_modules/.pnpm/@vueuse_core@12.0.0_typescript@5.6.2/node_modules/@vueuse/core/index.js";
const s = (i) => {
if (!i.value)
return {
clientWidth: [],
clientWidthSum: 0,
offsetWidth: [],
offsetWidthSum: 0
};
const n = l(i).value;
let r = 0;
const h = Array.from(n.children).map((e) => {
const t = e.offsetWidth;
return r += t, t;
});
let d = 0;
return {
clientWidth: Array.from(n.children).map((e) => {
const t = e.clientWidth;
return d += t, t;
}),
clientWidthSum: d,
offsetWidth: h,
offsetWidthSum: r
};
};
export {
s as default
};