ant-design-x-vue-next
Version:
Ant Design X for Vue — community continuation aligned with @ant-design/x
20 lines (19 loc) • 519 B
JavaScript
import { ref as d, onMounted as r, onUnmounted as s } from "vue";
function u(a = "(pointer: coarse)") {
const t = d(!1);
return r(() => {
var o;
if (typeof window > "u" || !window.matchMedia) return;
const e = window.matchMedia(a), n = () => {
t.value = e.matches;
};
n(), (o = e.addEventListener) == null || o.call(e, "change", n), s(() => {
var i;
(i = e.removeEventListener) == null || i.call(e, "change", n);
});
}), t;
}
export {
u as default,
u as useMobile
};