Using routing in Vue3.0 to jump, pass parameters and obtain values

1. Route jump in vue2.0

 

 2. Get the route’s value in vue2.0

 

 Invue3.0, some APIs of vue2.0 have been cancelled, and two new APIs are useRouter and useRoute.

 3, vue3.0 middle road jump

 1) The first step is to introduce import {useRouter} from 'vue-router';

 

 2) The second step const router = useRouter();

 

 3) The third step router.push({path:'/home', query:{id:'12' }})

 

4. How to get the route value in vue3.0 

 1) The first step is to introduce import {useRoute} from 'vue-router';

 2) The second step const route = useRoute();

 

 3) The third step route.query.id

 

Guess you like

Origin blog.csdn.net/weixin_48594833/article/details/126619166