解决办法,给路由添加key
<template>
<router-view :key="key" />
</template>
<script setup>
import { useRoute} from "vue-router";
import { computed } from "vue";
// 路由中添加key解决切换路由时页面不展示内容,刷新后才展示内容问题
const route = useRoute();
const key = computed(() => {
return route.path + Math.random();
});
</script>
<style>
</style>