點擊按鈕實現路由的跳轉
<div @click="gotoMenu">按鈕</div>
實現跳轉
methods: { gotoMenu(){ //跳轉到上一次瀏覽的頁面 this.$router.go(-1) this.$router.go(-1) //指定跳轉的地址 this.$router.replace('/menu') this.$router.replace('/menu') //指定跳轉的路由的名字下 this.$router.replace({name:'menu'}) this.$router.replace({name:'menu'}) //通過push進行跳轉 this.$router.push('/menu') } }, }
