在vue中 路由的跳转方式主要有下列4种:
1、跳转到上一次浏览的页面
2、指定跳转的地址
3、指定跳转路由的名字下
4、通过push进行跳转
希望对大家有所帮助
<script>
export default {
methods:{
goToMenu(){
//跳转到上一次浏览的页面
//this.$router.go(-1)
//指定跳转的地址,我们自己设置的路由地址
//this.$router.replace('/menu')
//指定跳转路由的名字下,menuLink是我们自身为路由设置的名字
//this.$router.replace({name:"menuLink"})
//通过push进行跳转,我们自己设置的路由地址或者我们自己设置的名字
//this.$router.push('/menu')
this.$router.push({name:'menuLink'})
}
}
}
</script>