摘要: 1.router下的index.js页面配置映射规则中为每一个路由添加meta元数据设置title名字 { path: '/about', component: About, meta:{ title:'关于' } }, 2.在index.js文件中添加路由导航守卫 1.前置守卫 to:即将要进入目 阅读全文
posted @ 2021-07-01 15:49 ajaXJson 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 传递参数主要有两种类型:params和query 1.params的类型: 配置路由格式 /router/:id 传递的方式:在path后面跟上对应的值 传递后形成的路径:/router/123, /router/abc 1.定义数据 data(){ return { userId:'zhangsa 阅读全文
posted @ 2021-07-01 13:58 ajaXJson 阅读(104) 评论(0) 推荐(0) 编辑
摘要: App.vue页面修改为click事件 <button @click="userClick">用户</button> <button @click="profileClick">档案</button> methods函数中添加 userClick(){ this.$router.push('/use 阅读全文
posted @ 2021-07-01 13:56 ajaXJson 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 1.新建profile.vue页面 2.index.js页面懒加载形式导入,配置路由映射表挂载 const Profile =()=> import('../components/Profile.vue') { path:'/profile', component:Profile } 3.App.v 阅读全文
posted @ 2021-07-01 13:55 ajaXJson 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 1.新建HomeMessgae.vue与HomeNews.vue页面 <template> <div> <ul> <li>消息1</li> <li>消息1</li> <li>消息1</li> <li>消息1</li> <li>消息1</li> </ul> </div> <template> <div 阅读全文
posted @ 2021-07-01 13:54 ajaXJson 阅读(76) 评论(0) 推荐(0) 编辑