Vue路由跳转可以使用router-link组件或者this.$router.push()方法。

使用router-link组件:

<router-link to="/example">跳转到Example页面</router-link>

使用this.$router.push()方法:

this.$router.push('/example');

其中,topush方法的参数都是跳转的目标路由路径。在使用push方法时,可以传递一个对象作为参数,对象中可以包含路由参数、查询参数等信息。

例如:

this.$router.push({path: '/example', query: {id: 1}});

这样就会跳转到/example?id=1这个路由路径。

vue路由跳转

原文地址: https://www.cveoy.top/t/topic/gsOz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录