266 lines
5.0 KiB
JavaScript
266 lines
5.0 KiB
JavaScript
import Vue from 'vue'
|
||
import VueRouter from 'vue-router'
|
||
|
||
// 引入页面组件
|
||
import Home from '@/pages/Home/index.vue';
|
||
import AboutIndex from '@/pages/About/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';
|
||
import ViewMore from "@/pages/Home/views/ViewMore.vue";
|
||
import List from "@/pages/Home/views/List.vue";
|
||
import Detail from "@/pages/ToolDetail/index.vue";
|
||
import Launches from "@/pages/Launches/index.vue";
|
||
import DailyNews from "@/pages/DailyNews/index.vue";
|
||
import AIToolsDetail from "@/pages/AIHub/AIToolsDetail.vue";
|
||
import Learn from "@/pages/Learn/index.vue";
|
||
import Observer from "@/pages/Learn/Observer.vue";
|
||
import Depth from "@/pages/Learn/Depth.vue";
|
||
import Pioneer from "@/pages/Learn/Pioneer.vue";
|
||
import LaunchesDetail from "@/pages/Launches/Detail/index.vue";
|
||
import FinanceDetail from "@/pages/Launches/FinanceDetail/index.vue";
|
||
|
||
Vue.use(VueRouter)
|
||
|
||
export const routes = [
|
||
{
|
||
path: '/',
|
||
name: 'home-redirect',
|
||
redirect: '/home',
|
||
meta: {
|
||
parent: 'Home',
|
||
}
|
||
},{
|
||
path: '/home',
|
||
name: 'home',
|
||
component: Home,
|
||
redirect: '/home/list',
|
||
meta: {
|
||
navigationName: "Home",
|
||
hidden: false,
|
||
parent: 'Home',
|
||
}, //navigationName:显示在header组件里面导航按钮的名字 hidden:是否在导航栏里面显示
|
||
children: [
|
||
{
|
||
path: 'list',
|
||
name: 'list',
|
||
component: List,
|
||
meta: {
|
||
navigationName: 'List',
|
||
hidden: true,
|
||
parent: 'Home',
|
||
},
|
||
},
|
||
{
|
||
path: 'more',
|
||
name: 'more',
|
||
component: ViewMore,
|
||
meta: {
|
||
navigationName: 'View More',
|
||
hidden: true,
|
||
parent: 'Home',
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
path: '/detail',
|
||
name: 'Tool Detail',
|
||
component: Detail,
|
||
meta: {
|
||
navigationName: "Tool ToolDetail",
|
||
hidden: true,
|
||
parent: 'Home',
|
||
}
|
||
},
|
||
{
|
||
path: '/launches',
|
||
name: 'AI Launches',
|
||
component: Launches,
|
||
meta: {
|
||
navigationName: "AI Launches",
|
||
hidden: false,
|
||
parent: 'Launches',
|
||
}
|
||
},
|
||
{
|
||
path: '/launches/detail',
|
||
name: 'AI Launches Detail',
|
||
component: LaunchesDetail,
|
||
meta: {
|
||
navigationName: "AI Launches Detail",
|
||
hidden: true,
|
||
// parent: 'Launches',
|
||
},
|
||
},
|
||
{
|
||
path: '/finance-detail',
|
||
name: 'Finance',
|
||
component: FinanceDetail,
|
||
meta: {
|
||
navigationName: "Finance",
|
||
hidden: true,
|
||
// parent: 'Launches',
|
||
}
|
||
},
|
||
{
|
||
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, // 隐藏于主导航,只在子菜单显示
|
||
parent: 'Hub',
|
||
color: '#FFF6F3',
|
||
}
|
||
},
|
||
{
|
||
path: '/frameworks', // 路径改为全小写更规范
|
||
name: 'Frameworks',
|
||
component: Frameworks,
|
||
meta: {
|
||
icon: 'frameworks',
|
||
hidden: true,
|
||
parent: 'Hub',
|
||
color: '#F3FFF3',
|
||
}
|
||
},
|
||
]
|
||
},
|
||
{
|
||
path: '/tools-detail',
|
||
name: 'Tool Detail',
|
||
component: AIToolsDetail,
|
||
meta: {
|
||
icon: 'tools',
|
||
hidden: true,
|
||
}
|
||
},
|
||
{
|
||
path: '/dailyNews',
|
||
name: 'AI Daily News',
|
||
component: DailyNews,
|
||
meta: {
|
||
navigationName: "AI Daily News",
|
||
hidden: false,
|
||
parent: 'DailyNews',
|
||
},
|
||
},
|
||
{
|
||
path: '/learn',
|
||
name: 'Learn',
|
||
component: Learn,
|
||
meta: {
|
||
navigationName: "Learn",
|
||
hidden: false,
|
||
children: true,
|
||
},
|
||
children: [{
|
||
name: 'AI Observer',
|
||
path: '/observer',
|
||
component: Observer,
|
||
meta: {
|
||
icon: 'observer',
|
||
hidden: true,
|
||
parent: 'Learn',
|
||
color: '#FFFBF3',
|
||
}
|
||
},
|
||
{
|
||
name: 'In-depth Analysis',
|
||
path: '/analysis',
|
||
component: Depth,
|
||
meta: {
|
||
icon: 'analysis',
|
||
hidden: true,
|
||
parent: 'Learn',
|
||
color: '#FFF3FE',
|
||
}
|
||
},
|
||
{
|
||
name: 'Pioneer In The Field',
|
||
path: '/pioneer',
|
||
component: Pioneer,
|
||
meta: {
|
||
icon: 'pioneer',
|
||
hidden: true,
|
||
parent: 'Learn',
|
||
color: '#FFF3F3',
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
path: '/about',
|
||
name: 'About Us',
|
||
component: AboutIndex,
|
||
meta: {
|
||
navigationName: "About Us",
|
||
hidden: false
|
||
},
|
||
children: [{
|
||
path: '/privacy',
|
||
component: Privacy,
|
||
meta: {
|
||
hidden: true,
|
||
parent: 'Privacy',
|
||
}
|
||
},
|
||
{
|
||
path: '/about',
|
||
component: About,
|
||
meta: {
|
||
hidden: true,
|
||
parent: 'About',
|
||
}
|
||
},
|
||
{
|
||
path: '/service',
|
||
component: Service,
|
||
meta: {
|
||
hidden: true,
|
||
parent: 'Service',
|
||
}
|
||
}
|
||
]
|
||
|
||
},
|
||
|
||
{
|
||
path: '*',
|
||
redirect: '/',
|
||
meta: {
|
||
navigationName: "404",
|
||
hidden: true,
|
||
parent: 'Home',
|
||
}
|
||
}
|
||
]
|
||
|
||
const router = new VueRouter({
|
||
mode: 'history',
|
||
// mode: 'hash',
|
||
// base:'/example/', //服务器资源放在子路径下,不在根路径时配置
|
||
routes,
|
||
scrollBehavior: () => ({
|
||
y: 0,
|
||
behavior: 'smooth'
|
||
}), //当更新路由时,滚动条滑动到顶部
|
||
})
|
||
|
||
export function createRouter() {
|
||
return router
|
||
}
|