VUE 中页面跳转的方式

一、router-link标签跳转 (声明式)

 <router-link to='xxx.html'><button>点我到新页面</button></router-link>

  

二、绑定点击事件跳转 (编程式)

  1、先绑定newPage()方法

<button @click="newPage">回到首页</button>

  2、在script模块里加入newPage方法,并用this.$router.push(‘/’)导航到新页面

export default {
    name: 'app',
    methods: {
        newPage(){
            this.$router.push('/dashboard');//或者 this.$router.push({ path:'/new.html'})
        }
    }
}

  三、其他

//  后退一步记录,等同于 history.back()
this.$router.go(-1)