vue 頁面跳轉的兩種方式


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) }) } }

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM