摘要: vue ui 阅读全文
posted @ 2022-06-16 16:03 hi123hi159 阅读(7) 评论(0) 推荐(0) 编辑
摘要: router.js // 全局路由导航守卫 router.beforeEach((to, from, next) => { const tokenStr = localStorage.getItem('token') if (to.path '/main' && !tokenStr) { // 证明 阅读全文
posted @ 2022-06-08 14:36 hi123hi159 阅读(58) 评论(0) 推荐(0) 编辑
摘要: router.js { name: 'mov', path: '/movie/:mid', component: Movie, props: true }, home.vue <template> <div> <h3>MyHome 组件</h3> <router-link :to="{ name: 阅读全文
posted @ 2022-06-08 14:17 hi123hi159 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 导航到另一个页面 <template> <div> <h3>MyHome 组件</h3> <button type="button" class="btn btn-primary" @click="goToMovie(3)">导航到Movie页面</button> </div> </template 阅读全文
posted @ 2022-06-08 13:44 hi123hi159 阅读(64) 评论(0) 推荐(0) 编辑
摘要: router.js import { createRouter, createWebHashHistory } from 'vue-router' import Home from './MyHome.vue' import Movie from './MyMovie.vue' import Abo 阅读全文
posted @ 2022-06-08 13:16 hi123hi159 阅读(794) 评论(0) 推荐(0) 编辑
摘要: router.js import { createRouter, createWebHashHistory } from 'vue-router' import Home from './MyHome.vue' import Movie from './MyMovie.vue' import Abo 阅读全文
posted @ 2022-06-08 13:01 hi123hi159 阅读(245) 评论(0) 推荐(0) 编辑
摘要: router.js // 自定义路由高亮的 class 类 linkActiveClass: 'active-router', index.css .active-router { background-color: blue; color: white; font-weight: bold; } 阅读全文
posted @ 2022-06-08 12:15 hi123hi159 阅读(40) 评论(0) 推荐(0) 编辑
摘要: route.js routes: [ { path: '/', redirect: '/home' }, { path: '/home', component: Home }, ], 阅读全文
posted @ 2022-06-08 12:06 hi123hi159 阅读(155) 评论(0) 推荐(0) 编辑
摘要: app.vue <template> <div> <h1>vue-router 的基本使用</h1> <!-- 声明路由链接 --> <router-link to="/home">首页</router-link>&nbsp; <router-link to="/movie">电影</router- 阅读全文
posted @ 2022-06-06 15:00 hi123hi159 阅读(28) 评论(0) 推荐(0) 编辑
摘要: npm i vue-router@next -S 阅读全文
posted @ 2022-06-06 14:03 hi123hi159 阅读(95) 评论(0) 推荐(0) 编辑