上一页 1 2 3 4 5 6 7 8 ··· 77 下一页
摘要: 一、概念 1、对与url来说 # 后面的内容就是hash值 2、hash值不包含在http请求中,即:hsah值不会带给服务器 3、hash模式 a、地址不美观带有# b、地址可能会被校验不合法 c、兼容性好 4、histroy模式 a、地址干净、整洁 b、兼容性比hash模式差 c、部署需要解决服 阅读全文
posted @ 2025-01-08 23:30 市丸银 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1、顺序 2、位置 组件内部 3、语法 beforeRouteEnter 通过路由规则,进入该组件时被调佣 beforeRouteLeave通过路由规则,离开该组件时被调用 注意:通过组件引入不被调用 beforeRouteEnter (to, from, next) { // ... consol 阅读全文
posted @ 2025-01-08 22:51 市丸银 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1、位置 src/router/index.js 写在路由中 2、顺序 在全局 前置守卫 执行后执行 2、语法 { path:'news', component: NewsData, meta:{isAuth:true, title:'新闻'}, beforeEnter: (to, from, ne 阅读全文
posted @ 2025-01-08 22:35 市丸银 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 一、位置 src/router/index.js const router = new VueRouter({ routes:[ ] }) // 这个地方写全局前置路由守卫或 全局后置路由守卫 export default router 一、全局前置路由守卫 1、时间:初始化时被调用,每次切换前被调 阅读全文
posted @ 2025-01-08 22:17 市丸银 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 1、作用 路由独有的两个生命周期函数,用于捕获路由组件的激活状态,激活路由调用 2、功能, 只有 组件被 keep-alive 包裹时才能生效 activated路由组件被激活时调用 activated(){} deactivated路由组件失活时调用 deactivated(){} 阅读全文
posted @ 2025-01-08 19:59 市丸银 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 路由切换,组件自动销毁,想要保留A组件的数据,需要确认A组件路由所在的组件,在该组件中包<router-view> <keep-alive include="NewsData"> <router-view></router-view> </keep-alive> include=组件名称 不写inc 阅读全文
posted @ 2025-01-08 18:54 市丸银 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 一、作用 不借助<router-link>实现路由跳转 二、路由 (push replace) 借助 $router 的push(保存浏览记录) 和replace(替换浏览记录) 与 query和params对象传参类似 1、push 触发 <button @click="pushShow(m)"> 阅读全文
posted @ 2025-01-08 18:34 市丸银 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1、作用 控制路由跳转时操作浏览器历史记录的模式 2、两种 push:追加历史记录 replace:替换历史记录 默认为 push 3、设置 添加 replace 属性 <router-link replace class="list-group-item" active-class="active 阅读全文
posted @ 2025-01-08 17:10 市丸银 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1、作用 让路由组件便于接受参数 2、写法(三种) src/router/index.js a、简单 值为对象,通过props传递给组件,组件需要接受 { name:'detail', // params参数 需要占位符 path:'detail/:id/:title', component: De 阅读全文
posted @ 2025-01-08 16:56 市丸银 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 一、传递参数 1、路由(占位符) src/router/index.js children:[ { name:'detail', // params参数 需要占位符 path:'detail/:id/:title', component: DetailData }, ] 2、传递(对象) 注意:pa 阅读全文
posted @ 2025-01-08 16:09 市丸银 阅读(1) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 77 下一页