<script setup name="Welcome"> import { onMounted } from 'vue'; import { useRouter } from 'vue-router'; const $router = useRouter(); onMounted(() => { console.log('$router:', $router.currentRoute.value.params.caseId); }); </script>
$router.currentRoute.value.params.caseId获取不到的话可以
$router.currentRoute.value先打印出来,再找到对应值在哪里标签:url,onMounted,caseId,value,参数,currentRoute,vue3,router From: https://www.cnblogs.com/bisiyuan/p/17260693.html