06 2022 档案
摘要:router.js // 全局路由导航守卫 router.beforeEach((to, from, next) => { const tokenStr = localStorage.getItem('token') if (to.path '/main' && !tokenStr) { // 证明
阅读全文
摘要:router.js { name: 'mov', path: '/movie/:mid', component: Movie, props: true }, home.vue <template> <div> <h3>MyHome 组件</h3> <router-link :to="{ name:
阅读全文
摘要:导航到另一个页面 <template> <div> <h3>MyHome 组件</h3> <button type="button" class="btn btn-primary" @click="goToMovie(3)">导航到Movie页面</button> </div> </template
阅读全文
摘要:router.js import { createRouter, createWebHashHistory } from 'vue-router' import Home from './MyHome.vue' import Movie from './MyMovie.vue' import Abo
阅读全文
摘要:router.js import { createRouter, createWebHashHistory } from 'vue-router' import Home from './MyHome.vue' import Movie from './MyMovie.vue' import Abo
阅读全文
摘要:router.js // 自定义路由高亮的 class 类 linkActiveClass: 'active-router', index.css .active-router { background-color: blue; color: white; font-weight: bold; }
阅读全文
摘要:route.js routes: [ { path: '/', redirect: '/home' }, { path: '/home', component: Home }, ],
阅读全文
摘要:app.vue <template> <div> <h1>vue-router 的基本使用</h1> <!-- 声明路由链接 --> <router-link to="/home">首页</router-link> <router-link to="/movie">电影</router-
阅读全文
摘要:app.vue <template> <div> <h1>App 根组件</h1> <a href="#/home">Home</a> <a href="#/movie">Movie</a> <a href="#/about">About</a> <hr /> <
阅读全文
摘要:app.vue <template> <div> <h1>App 根组件</h1> <hr /> <!-- 使用组件 --> <my-home></my-home> </div> </template> <script> // 导入组件 import MyHome from './Home.vue'
阅读全文
摘要:app.vue <template> <div> <h1>App 根组件</h1> <hr /> <!-- 使用自定义组件 --> <my-test> <template #default="{ msg, info }"> <p>{{ msg }}</p> <p>{{ info.address }}
阅读全文
摘要:app.vue <template> <div> <h1>App 根组件</h1> <hr /> <!-- 使用组件 --> <my-article> <template #header> <h1>滕王阁序</h1> </template> <template #default> <p>豫章故郡,洪
阅读全文
摘要:app.vue <template> <div> <h1>App 根组件</h1> <hr /> <!-- 使用组件 --> <my-com> </my-com> </div> </template> <script> // 导入组件 import MyCom from './MyCom.vue'
阅读全文
摘要:app.vue <template> <div> <h1 class="mb-4">App 根组件</h1> <button type="button" class="btn btn-primary" @click="comName = 'MyHome'">首页</button> <button t
阅读全文
摘要:npm init vite-app 项目名称 cd 项目路径 npm i npm run dev
阅读全文
浙公网安备 33010602011771号