| 12345678910111213141516171819202122232425262728293031 |
- <template>
- <AccountCardMobile v-if="isGridLayout" :account="account" />
- <AccountCardDesktop v-else :account="account" />
- </template>
- <script setup lang="ts">
- import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
- import AccountCardMobile from './AccountCardMobile.vue';
- import AccountCardDesktop from './AccountCardDesktop.vue';
- const props = defineProps<{
- account: any;
- isGridLayout?: boolean;
- }>();
- // 检测是否为移动端
- const isMobile = ref(false);
- const checkIsMobile = () => {
- isMobile.value = window.innerWidth <= 1100;
- };
- onMounted(() => {
- checkIsMobile();
- window.addEventListener('resize', checkIsMobile);
- });
- onBeforeUnmount(() => {
- window.removeEventListener('resize', checkIsMobile);
- });
- </script>
|