main.js 1.25 KB
/*
 * @Date: 2025-04-17 14:26:17
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2025-04-21 15:07:36
 * @FilePath: /mlaj-reading-club/src/main.js
 * @Description: 文件描述
 */
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createRouter, createWebHistory } from 'vue-router'
import App from './App.vue'
import './index.css'

// 创建Vue应用实例
const app = createApp(App)

// 创建Pinia状态管理实例
const pinia = createPinia()
app.use(pinia)

// 创建路由实例
const router = createRouter({
  history: createWebHistory(),
  routes: [
    { path: '/', component: () => import('./pages/HomePage.vue') },
    { path: '/activity/:id', component: () => import('./pages/ActivityDetail.vue') },
    { path: '/create-activity', component: () => import('./pages/CreateActivity.vue') },
    { path: '/profile', component: () => import('./pages/UserProfile.vue') },
    { path: '/registration/:activityId', component: () => import('./pages/Registration.vue') },
    { path: '/check-in/:id', component: () => import('./pages/CheckIn.vue') },
    { path: '/messages', component: () => import('./pages/Messages.vue') },
    { path: '/:pathMatch(.*)*', redirect: '/' }
  ]
})
app.use(router)

// 挂载应用
app.mount('#root')