home主页和AiTools页
This commit is contained in:
163
router.js
Normal file
163
router.js
Normal file
@ -0,0 +1,163 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
|
||||
// 引入页面组件
|
||||
import Home from '@/pages/Home/index.vue'
|
||||
import AboutIndex from '@/pages/About/index.vue'
|
||||
import User from '@/pages/User/index.vue'
|
||||
import Login from '@/pages/Login/index.vue'
|
||||
import Privacy from '@/pages/About/Privacy.vue'
|
||||
import About from '@/pages/About/About.vue'
|
||||
import Service from '@/pages/About/Service.vue'
|
||||
import AIHub from '@/pages/AIHub/index.vue'
|
||||
import AITools from '@/pages/AIHub/AITools.vue'
|
||||
import Frameworks from '@/pages/AIHub/Frameworks.vue'
|
||||
Vue.use(VueRouter)
|
||||
|
||||
export const routes = [{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
meta: {
|
||||
navigationName: "Home",
|
||||
hidden: false
|
||||
} //navigationName:显示在header组件里面导航按钮的名字 hidden:是否在导航栏里面显示
|
||||
},
|
||||
{
|
||||
path: '/launches',
|
||||
name: 'AI Launches',
|
||||
component: About,
|
||||
meta: {
|
||||
navigationName: "AI Launches",
|
||||
hidden: false
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/hub',
|
||||
name: 'AI Hub',
|
||||
component:AIHub,
|
||||
meta: {
|
||||
navigationName: "AI Hub",
|
||||
hidden: false,
|
||||
children: true,
|
||||
},
|
||||
children: [{
|
||||
path: '/tools', // 相对路径,实际路径会是/hub/tools
|
||||
name: 'AI Tools',
|
||||
component: AITools,
|
||||
meta: {
|
||||
icon: 'tools',
|
||||
hidden: true // 隐藏于主导航,只在子菜单显示
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/frameworks', // 路径改为全小写更规范
|
||||
name: 'Frameworks',
|
||||
component: Frameworks,
|
||||
meta: {
|
||||
icon: 'frameworks',
|
||||
hidden: true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'AI Daily News',
|
||||
component: Login,
|
||||
meta: {
|
||||
navigationName: "AI Daily News",
|
||||
hidden: false
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/learn',
|
||||
name: 'Learn',
|
||||
component: Login,
|
||||
meta: {
|
||||
navigationName: "Learn",
|
||||
hidden: false,
|
||||
children: true,
|
||||
},
|
||||
children: [{
|
||||
name: 'AI Observer',
|
||||
path: '/observer',
|
||||
component: Privacy,
|
||||
meta: {
|
||||
icon: 'observer',
|
||||
hidden: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'In-depth Analysis',
|
||||
path: '/analysis',
|
||||
component: About,
|
||||
meta: {
|
||||
icon: 'analysis',
|
||||
hidden: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Pioneer In The Field',
|
||||
path: '/pioneer',
|
||||
component: Service,
|
||||
meta: {
|
||||
icon: 'pioneer',
|
||||
hidden: true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/about',
|
||||
name: 'About Us',
|
||||
component: AboutIndex,
|
||||
meta: {
|
||||
navigationName: "About Us",
|
||||
hidden: false
|
||||
},
|
||||
children: [{
|
||||
path: '/privacy',
|
||||
component: Privacy,
|
||||
meta: {
|
||||
hidden: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/about',
|
||||
component: About,
|
||||
meta: {
|
||||
hidden: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/service',
|
||||
component: Service,
|
||||
meta: {
|
||||
hidden: true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
path: '*',
|
||||
redirect: '/'
|
||||
}
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: 'history',
|
||||
// mode: 'hash',
|
||||
// base:'/example/', //服务器资源放在子路径下,不在根路径时配置
|
||||
routes,
|
||||
scrollBehavior: () => ({
|
||||
y: 0,
|
||||
behavior: 'smooth'
|
||||
}), //当更新路由时,滚动条滑动到顶部
|
||||
})
|
||||
|
||||
export function createRouter() {
|
||||
return router
|
||||
}
|
||||
Reference in New Issue
Block a user