ruoyi-vue如何修改默认打开页面是其他的
时间: 2023-08-07 18:01:06 浏览: 120
要修改ruoyi-vue的默认打开页面,需要修改路由配置文件。
首先,进入到ruoyi-vue项目的src/router目录,找到index.js文件。
在index.js文件中,会看到如下代码:
```
export const constantRouterMap = [
{
path: '/',
component: Layout,
redirect: '/dashboard',
hidden: true,
children: [
{
path: 'dashboard',
component: () => import('@/views/dashboard/index'),
name: 'Dashboard',
meta: { title: '首页', icon: 'dashboard', noCache: true }
}
]
},
...
]
```
这段代码定义了ruoyi-vue的默认打开页面为`/dashboard`,即首页。如果要修改默认打开页面为其他页面,可以修改这段代码中的path和component。比如要修改默认打开页面为用户管理页面,可以将path修改为`/system/user/index`,component修改为用户管理的组件。
修改后的代码如下:
```
export const constantRouterMap = [
{
path: '/',
component: Layout,
redirect: '/system/user/index',
hidden: true,
children: [
{
path: 'system/user/index',
component: () => import('@/views/system/user/index'),
name: 'User',
meta: { title: '用户管理', icon: 'user', noCache: true }
}
]
},
...
]
```
保存修改后的代码,并重新启动ruoyi-vue项目,就可以看到修改后的默认打开页面为用户管理页面了。