摘要:
一、作用 不借助<router-link>实现路由跳转 二、路由 (push replace) 借助 $router 的push(保存浏览记录) 和replace(替换浏览记录) 与 query和params对象传参类似 1、push 触发 <button @click="pushShow(m)"> 阅读全文
posted @ 2025-01-08 18:34
市丸银
阅读(34)
评论(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
市丸银
阅读(50)
评论(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
市丸银
阅读(74)
评论(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
市丸银
阅读(52)
评论(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
市丸银
阅读(52)
评论(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
市丸银
阅读(56)
评论(0)
推荐(0)
摘要:
一、配置路由 关键字 children 注意 子路由 path 不加斜杠 src/router/index.js export default new VueRouter({ routes:[ { // path 是路径,component是组件 path: '/about', component: 阅读全文
posted @ 2025-01-08 14:49
市丸银
阅读(61)
评论(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
市丸银
阅读(43)
评论(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
市丸银
阅读(22)
评论(0)
推荐(0)
摘要:
1、创建Js文件 每个组件单独一个js文件,在src/sore中 2、每个组件文件中,默认暴露,actions mutations state gettters namespaced:true export default { namespaced: true, actions:{}, mutati 阅读全文
posted @ 2025-01-08 10:31
市丸银
阅读(35)
评论(0)
推荐(0)

浙公网安备 33010602011771号