在項目文件中,如果是vue頁面中的內部跳轉,用this.$router.push()可以實現,
例如:
this.$router.push({path: '/channeldetailview', query: {channelid: this.data.id}});
跳到外部鏈接,不能用這個。不然就會報錯,看一下鏈接的路徑,原來外部鏈接前面加上了http://localhost:8080/#/這一串導致跳轉出現問題
那么我們如何跳轉到外部鏈接呢,我們只需用 window.location.href = ‘url’來實現
例如:
window.location.href = examurl
window.location.href = 'www.baidu.com'