fix(client): Solve the problem of not automatically jumping to /admin/overview when accessing the /admin page for the second time (#10264)

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
Launchpad 2023-03-10 01:22:47 +08:00 committed by GitHub
parent 228c92f2ca
commit caf646fcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -23,7 +23,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, provide, watch } from 'vue'; import { onActivated, onMounted, onUnmounted, provide, watch } from 'vue';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import MkSuperMenu from '@/components/MkSuperMenu.vue'; import MkSuperMenu from '@/components/MkSuperMenu.vue';
import MkInfo from '@/components/MkInfo.vue'; import MkInfo from '@/components/MkInfo.vue';
@ -204,6 +204,13 @@ onMounted(() => {
} }
}); });
onActivated(() => {
narrow = el.offsetWidth < NARROW_THRESHOLD;
if (currentPage?.route.name == null && !narrow) {
router.push('/admin/overview');
}
});
onUnmounted(() => { onUnmounted(() => {
ro.disconnect(); ro.disconnect();
}); });