vue3获取url参数的值

<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先打印出来,再找到对应值在哪里
posted @ 2023-03-27 10:29  seven&night  阅读(2035)  评论(0编辑  收藏  举报