diff --git a/入门/cli/hello-router/package-lock.json b/入门/cli/hello-router/package-lock.json
index aef75a9..41ccecd 100644
--- a/入门/cli/hello-router/package-lock.json
+++ b/入门/cli/hello-router/package-lock.json
@@ -10126,14 +10126,11 @@
},
"node_modules/vue-router": {
"version": "4.1.6",
- "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.1.6.tgz",
+ "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-4.1.6.tgz",
"integrity": "sha512-DYWYwsG6xNPmLq/FmZn8Ip+qrhFEzA14EI12MsMgVxvHFDYvlr4NXpVF5hrRH1wVcDP8fGi5F4rxuJSl8/r+EQ==",
"dependencies": {
"@vue/devtools-api": "^6.4.5"
},
- "funding": {
- "url": "https://github.com/sponsors/posva"
- },
"peerDependencies": {
"vue": "^3.2.0"
}
@@ -18741,7 +18738,7 @@
},
"vue-router": {
"version": "4.1.6",
- "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.1.6.tgz",
+ "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-4.1.6.tgz",
"integrity": "sha512-DYWYwsG6xNPmLq/FmZn8Ip+qrhFEzA14EI12MsMgVxvHFDYvlr4NXpVF5hrRH1wVcDP8fGi5F4rxuJSl8/r+EQ==",
"requires": {
"@vue/devtools-api": "^6.4.5"
diff --git a/入门/cli/hello-router/src/App.vue b/入门/cli/hello-router/src/App.vue
index 6303621..0cb6055 100644
--- a/入门/cli/hello-router/src/App.vue
+++ b/入门/cli/hello-router/src/App.vue
@@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2022-11-24 01:13:55
* @LastEditors: Kane
- * @LastEditTime: 2022-11-24 01:47:59
+ * @LastEditTime: 2022-11-24 09:51:12
* @FilePath: \hello-router\src\App.vue
* @Description:
*
@@ -12,7 +12,9 @@
测试vue-router
页面一
- 页面二
+ 页面二
+ Kane
+ Aga
diff --git a/入门/cli/hello-router/src/components/功能页面/路由守卫.vue b/入门/cli/hello-router/src/components/功能页面/路由守卫.vue
new file mode 100644
index 0000000..d867f73
--- /dev/null
+++ b/入门/cli/hello-router/src/components/功能页面/路由守卫.vue
@@ -0,0 +1,33 @@
+
+
+ 路由守卫
+ {{ user.name }}
+
+
+
\ No newline at end of file
diff --git a/入门/cli/hello-router/src/main.js b/入门/cli/hello-router/src/main.js
index 51818de..b1fb244 100644
--- a/入门/cli/hello-router/src/main.js
+++ b/入门/cli/hello-router/src/main.js
@@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2022-11-24 01:13:55
* @LastEditors: Kane
- * @LastEditTime: 2022-11-24 01:34:13
+ * @LastEditTime: 2022-11-24 09:59:55
* @FilePath: \hello-router\src\main.js
* @Description:
*
@@ -10,24 +10,23 @@
*/
import { createApp } from "vue";
-import { createRouter, createWebHashHistory } from "vue-router";
+import { createRouter, createWebHashHistory } from 'vue-router';
import App from "./App.vue";
-import Demo1 from "./components/功能页面/demo-1.vue";
-import Demo2 from "./components/功能页面/demo-2.vue";
+import demo1 from "./components/功能页面/demo-1.vue";
+import demo2 from "./components/功能页面/demo-2.vue";
+import rg from "./components/功能页面/路由守卫.vue";
const app = createApp(App);
-
-//定义路由
const routes = [
- { path: "/demo-1", component: Demo1 },
- { path: "/demo-2", component: Demo2 },
+ { path: "/demo-1", component: demo1 },
+ { path: "/demo-2", component: demo2 },
+ { path: "/user/:username", component: rg }
];
-//创建路由对象
const router = createRouter({
history: createWebHashHistory(),
routes: routes
-});
+})
app.use(router);
app.mount("#app");
\ No newline at end of file