CviLux_fe/src/views/Test.vue
2024-10-03 12:03:45 +08:00

28 lines
647 B
Vue

<script setup>
import { onMounted, ref } from "vue";
const currentInfoModalData = ref(null);
const agent = ref("");
const isMobile = () => {
let flag =
/phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/gi.test(
navigator.userAgent
);
agent.value = navigator.userAgent;
currentInfoModalData.value = flag;
};
onMounted(() => {
isMobile();
});
</script>
<template>
<h1 class="text-2xl">
navigator.userAgent: {{ agent }}
<br />
isMobile: {{ currentInfoModalData }}
</h1>
</template>
<style lang="scss" scoped></style>