uv-ui
Version:
基于vue3的移动端组件库
20 lines (19 loc) • 387 B
JavaScript
import { unref as r } from "vue";
const c = (n) => n === window, e = (n, t) => ({
top: 0,
left: 0,
right: n,
bottom: t,
width: n,
height: t
}), u = (n) => {
const t = r(n);
if (c(t)) {
const o = t.innerWidth, i = t.innerHeight;
return e(o, i);
}
return t != null && t.getBoundingClientRect ? t.getBoundingClientRect() : e(0, 0);
};
export {
u as useRect
};