学习vue-router组件!!!

This commit is contained in:
2022-11-24 01:54:33 +08:00
parent 8424ca7203
commit c5e743706d
15 changed files with 19629 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/*
* @Author: Kane
* @Date: 2022-11-24 01:13:55
* @LastEditors: Kane
* @LastEditTime: 2022-11-24 01:34:13
* @FilePath: \hello-router\src\main.js
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { createApp } from "vue";
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";
const app = createApp(App);
//定义路由
const routes = [
{ path: "/demo-1", component: Demo1 },
{ path: "/demo-2", component: Demo2 },
];
//创建路由对象
const router = createRouter({
history: createWebHashHistory(),
routes: routes
});
app.use(router);
app.mount("#app");