首先需要對按鈕綁定一個函數(shù),然后在函數(shù)里進行頁面路由的改變。
這里要確保項目中已經(jīng)在使用vue-router。
如圖,我想要跳轉(zhuǎn)到這個index.vue頁面
那么按鈕綁定的函數(shù)里的路徑應該這么寫:
然后需要在router文件夾下的index.js里進行該頁面的注冊:
最主要的是我紅框里的內(nèi)容
代碼如下文章來源:http://www.zghlxwxcb.cn/news/detail-563109.html
{
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)成功啦!文章來源地址http://www.zghlxwxcb.cn/news/detail-563109.html
到了這里,關(guān)于vue點擊按鈕實現(xiàn)跳轉(zhuǎn)到另一個vue頁面的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!