步骤:
内容管理-组件与路由
1.在src下的views文件夹下,创建article文件夹,且 新建一个index.vue文件
<template>
<div class='container'>Article</div>
</template>
<script>
export default {}
</script>
<style scoped lang='less'></style>
2.在src下的router文件夹中的index.js文件里,导入article组件
import Article from '@/views/article'
3.路由规则:第二层级,配置子路由
{
path: '/',
component: Home,
children: [
// 欢迎页面 如果子路由有名字 父级路由需要删除
{ path: '/', name: 'welcome', component: Welcome },
+ { path: '/article', name: 'article', component: Article }
]
},
4.渲染出页面,网址中输入url地址
localhost:8080/#/article