vue點擊按鈕跳轉(zhuǎn)到另一個vue頁面實現(xiàn)方法
首先需要對按鈕綁定一個函數(shù),然后在函數(shù)里進行頁面路由的改變。這里要確保項目中已經(jīng)在使用vue-router。如圖,我想要跳轉(zhuǎn)到這個index.vue頁面
那么按鈕綁定的函數(shù)里的路徑應該這么寫:
然后需要在router文件夾下的index.js里進行該頁面的注冊:
最主要的是我紅框里的內(nèi)容
代碼如下
{ path: '/directory', component: Layout, name: 'Directory', meta: { title: 'Directory', icon: 'el-icon-s-cooperation' }, redirect: '/directory/index', children: [ { path: '', name: 'Directory', component: () => import('@/views/directory/index'), meta: { title: 'navRoute.directory', icon: 'el-icon-s-cooperation', roles: ['user'] } }, { path: 'newfilter/index', name: 'Newfilter', hidden: true, component: () => import('@/views/directory/newfilter/index'), meta: { title: 'navRoute.newfilter', roles: ['user'] } }, { path: '*', redirect: 'directory/index', hidden: true } ] },
然后就可以跳轉(zhuǎn)成功啦!
總結(jié)
到此這篇關于vue點擊按鈕跳轉(zhuǎn)到另一個vue頁面實現(xiàn)的文章就介紹到這了,更多相關vue點擊按鈕跳轉(zhuǎn)vue頁面內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
使用vue實現(xiàn)簡單鍵盤的示例(支持移動端和pc端)
這篇文章主要介紹了使用vue實現(xiàn)簡單鍵盤的示例(支持移動端和pc端),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-12-12vue使用$attrs和$listeners多級組件嵌套傳遞數(shù)據(jù)
這篇文章主要為大家介紹了vue使用$attrs和$listeners多級組件嵌套傳遞數(shù)據(jù)示例解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-08-08vue中filters 傳入兩個參數(shù) / 使用兩個filters的實現(xiàn)方法
這篇文章主要介紹了vue中filters 傳入兩個參數(shù) / 使用兩個filters的實現(xiàn)方法,文中給大家提到了Vue 中的 filter 帶多參的使用方法,需要的朋友可以參考下2019-07-07Vue+Java+Base64實現(xiàn)條碼解析的示例
這篇文章主要介紹了Vue+Java+Base64實現(xiàn)條碼解析的示例,幫助大家實現(xiàn)條碼解析,感興趣的朋友可以了解下2020-09-09vue中的v-model原理,與組件自定義v-model詳解
這篇文章主要介紹了vue中的v-model原理,與組件自定義v-model詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-08-08