feat: 添加路由

This commit is contained in:
王红彬
2024-09-06 15:05:42 +08:00
parent 31cfc61e1c
commit 868d1ffba4
7 changed files with 52 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
import { createApp } from 'vue';
import { createI18n } from 'vue-i18n';
import { createMemoryHistory, createRouter } from 'vue-router';
import App from './App.vue';
import HelloWorld from './components/HelloWorld.vue';
import './style.css';
const i18n = createI18n({
locale: 'zh',
@@ -18,7 +20,20 @@ const i18n = createI18n({
},
},
});
const routes = [
{ path: '/', component: App },
{ path: '/about', component: HelloWorld },
];
const router = createRouter({
history: createMemoryHistory(),
routes,
});
const app = createApp(App);
app.use(i18n);
app.use(router);
app.mount('#app');