1.標簽跳轉
<router-link to='two.html'><button>點我到第二個頁面</button></router-link>
2.點擊事件跳轉
htm:
<el-button type="primary" @click="doLogin">登錄</el-button>
js:
methods: { doLogin() { var that = this; axios .post('http://localhost/doLogin', this.loginData) .then(function (response) { console.log(response); if (response.data == "ok") { that.$router.push({path: './Index'}) } }) .error(function (error) { console.log(error) }) } }