added web and split CLAUDs
This commit is contained in:
parent
8ee33e4f5a
commit
8a82d10a7e
59 changed files with 15083 additions and 740 deletions
30
web/src/composables/useMobile.ts
Normal file
30
web/src/composables/useMobile.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { ref, onMounted, onUnmounted } from "vue";
|
||||
|
||||
// by convention, composable function names start with "use"
|
||||
export function useMobile() {
|
||||
const isMobile = ref<boolean>(false);
|
||||
|
||||
const handleWindowSizeChange = () => {
|
||||
isMobile.value = isMobileFunc();
|
||||
};
|
||||
|
||||
isMobile.value = isMobileFunc();
|
||||
function isMobileFunc() {
|
||||
if (screen.width <= 768) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
window.addEventListener("resize", handleWindowSizeChange);
|
||||
handleWindowSizeChange();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener("resize", handleWindowSizeChange);
|
||||
});
|
||||
|
||||
return isMobile;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue