上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 98 下一页
摘要: 路由切换,组件自动销毁,想要保留A组件的数据,需要确认A组件路由所在的组件,在该组件中包<router-view> <keep-alive include="NewsData"> <router-view></router-view> </keep-alive> include=组件名称 不写inc 阅读全文
posted @ 2025-01-08 18:54 市丸银 阅读(36) 评论(0) 推荐(0)
摘要: 一、作用 不借助<router-link>实现路由跳转 二、路由 (push replace) 借助 $router 的push(保存浏览记录) 和replace(替换浏览记录) 与 query和params对象传参类似 1、push 触发 <button @click="pushShow(m)"> 阅读全文
posted @ 2025-01-08 18:34 市丸银 阅读(39) 评论(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 市丸银 阅读(57) 评论(0) 推荐(0)
摘要: 1、作用 让路由组件便于接受参数 2、写法(三种) src/router/index.js a、简单 值为对象,通过props传递给组件,组件需要接受 { name:'detail', // params参数 需要占位符 path:'detail/:id/:title', component: De 阅读全文
posted @ 2025-01-08 16:57 市丸银 阅读(81) 评论(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 市丸银 阅读(57) 评论(0) 推荐(0)
摘要: 1、作用 简化多级路由 2、设置 src/router/index.js 在路由中添加 name 关键字 children:[ { name:'detail', path:'detail', component: DetailData }, ] 3、使用,配合传递参数,或者单个name关键字 to要 阅读全文
posted @ 2025-01-08 15:44 市丸银 阅读(55) 评论(0) 推荐(0)
摘要: 一、传递参数 1、固定参数 <router-link to="/home/message/detail?name=jojo&age=8">{{ m.title }}</router-link> 2、变化参数(对象写法) 关键字:path 路径(完整),query: 对象 <router-link : 阅读全文
posted @ 2025-01-08 15:34 市丸银 阅读(60) 评论(0) 推荐(0)
摘要: 一、配置路由 关键字 children 注意 子路由 path 不加斜杠 src/router/index.js export default new VueRouter({ routes:[ { // path 是路径,component是组件 path: '/about', component: 阅读全文
posted @ 2025-01-08 14:49 市丸银 阅读(68) 评论(0) 推荐(0)
摘要: 1、安装vue-router //Vue2 npm i vue-router@3 //vue3 npm i vue-router 2、使用VueRouter main.js // 引入VueRouter import VueRouter from "vue-router"; //使用 Vue.use 阅读全文
posted @ 2025-01-08 11:51 市丸银 阅读(50) 评论(0) 推荐(0)
摘要: 1、在pbulic文件夹中创建css文件夹,并存入bootstrap.css文件 2、在index.html文件中引入 <link rel="stylesheet" href="<%= BASE_URL %>css/bootstrap.css"> 阅读全文
posted @ 2025-01-08 11:07 市丸银 阅读(25) 评论(0) 推荐(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 98 下一页