import { createWebHistory, createRouter } from 'vue-router'
import Aericle from '../views/aericle.vue'
import home from '../views/home.vue'
import nonsense from '../views/nonsense.vue'
import messageboard from '../views/messageboard.vue'
import about from '../views/aboutme.vue'
import articlecontents from '../views/articlecontents.vue'
const routes = [
  {
    path: '/',
    redirect: '/:type' // 默认跳转到首页
  },
  {
    path: '/:type',
    // 如果type为空则是所有不为空查询相对应属性的文章
    name: '/home',
    component: home
  },
  {
    path: '/aericle',
    name: 'Aericle',
    component: Aericle
  },
  {
    path: '/nonsense',
    name: 'nonsense',
    component: nonsense

  },
  {
    path: '/message',
    name: 'messageboard',
    component: messageboard

  },
  {
    path: '/about',
    name: 'about',
    component: about

  },
  {
    path: '/articlecontents/:url',
    name: 'articlecontents',
    component: articlecontents
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router;