Vue 多级路由
router/index.js
//引入文件,该文件专门用于创建整个应用的路由器
import VueRouter from 'vue-router'
//引入组件
import About from '../components/Home'
import Home from '../components/About'
import Message from '../components/Message'
//创建并暴露一个路由器
export default new VueRouter({
routes: [{
path: '/about',
component: About
},
{
path: '/home',
component: Home,
children: [{ //通过children配置子级路由
path: "message", //这里不需要写‘/’斜杆
component: Message
}]
}
]
})
页面中
<router-link to="/home">home</router-link>
<router-link to="/about">about</router-link>
<router-link to="/home/message">message</router-link>
<router-view></router-view>
- 1
- 2
- 3
- 4





![战神引擎传奇手游【1.76盛战传奇免授权版[摸摸登陆器]】最新整理Win系复古服务端+安卓苹果双端+GM授权物品后台+详细搭建教程](https://cdn.jxasp.com:9143/image/20251106/1B4E8594B3BEB90E8601D63A8A39CB0B.jpg)













