2025-02-23 2025-02-23 Vue 概述简单记录下路由 安装安装软件 123npm install vue-router@4# oryarn add vue-router@4 创建项目,可以更快的搭建项目基础脚手架 123npm create vue@latest# oryarn create vue 基本配置1234567891011121314151617181920212223242526272829303132import { createRouter, createWebHashHistory } from 'vue-router'const routes = [ // { // path: '/', // name: 'login', // component: ViewLogin, // }, ]const router = createRouter({ history: createWebHashHistory(), routes,})// router.beforeEach((to, from, next) => {// loadingBar.start();// next(); // 继续导航// });// router.afterEach(() => {// loadingBar.finish(); // 导航完成后停止loading// });export default router 前一篇 Vue - Pinia状态管理 后一篇 Vue - 表单rules规则介绍