//跳转传参
import { useRouter, useRoute } from 'vue-router';
const router = useRouter()
const route = useRoute()
//新开页
function jump(id){
const url = router.resolve({
path:"/detail",
query:{
id:id
}
})
window.open(url.herf)
}
//当前页
function jump(id){
router.push({
path:"/detail",
query:{
id:id
}
})
}
取出路由的值
第一步先引入import {useRoute} from 'vue-router';
第二步 const route = useRoute();
第三步route.query.id
标签:vue,const,useRoute,跳转,Vue3,router,id From: https://www.cnblogs.com/tanchangsha/p/17120075.html