一、修改首页路由(解决刷新页面或关闭全部页面后的默认路由问题)
修改文件mcc-ui/src/router/index.js
{
path: '',
component: Layout,
redirect: 'index',
children: [
{
path: 'index',
component: (resolve) => require(['@/views/index'], resolve),
name: '首页',
meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}
]
},
改为
{
path: '',
component: Layout,
redirect: '自己的地址'
},
二、修改登陆后路由(把首页更换为其他页面)
修改文件:mcc-ui/src/views/login.vue
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({path: this.redirect || "/"}).catch(() => {
})
}).catch(() => {
this.loading = false;
})
改为
this.$store.dispatch("Login", this.loginForm).then(() => {
// this.$router.push({path: this.redirect || "/"}).catch(() => {
// })
this.$router.push({path: "自己的地址"}).catch(() => {
})
}).catch(() => {
this.loading = false;
})
三、点击首页后仍然跳转到自己配置的页面
修改文件mcc-ui/src/components/Breadcrumb/index.vue
if (!this.isDashboard(first)) {
matched = [{ path: '/index', meta: { title: '首页' }}].concat(matched)
}
修改为
if (!this.isDashboard(first)) {
matched = [{ path: '自己的地址', meta: { title: '首页' }}].concat(matched)
}