webglToy/src/page/index/router/index.js
2021-12-31 18:01:35 +08:00

134 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: your name
* @Date: 2020-09-10 18:52:15
* @LastEditTime: 2020-10-09 15:43:46
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /getCoinsEveryday/src/router/index.js
*/
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../Home/index.vue'
import Color from '../Color/index.vue'
import AR from '../AR/index.vue'
import ARHit from '../ARHit/index.vue'
import Camera from '../Camera/index.vue'
import HandTrack from '../HandTrack/index.vue'
import Video from '../Video/index.vue'
Vue.use(VueRouter)
const routes = [
{
path: "/",
name: "Home",
component: Home,
meta: {
title: "大板栗的玩具屋", // 标题
keepAlive: false, // 是否保持活跃
},
},
{
path: "/home",
name: "Home2",
component: Home,
meta: {
title: "大板栗的玩具屋", // 标题
keepAlive: false, // 是否保持活跃
},
},
{
path: "/color",
name: "Color",
component: Color,
meta: {
title: "Color", // 标题
keepAlive: false, // 是否保持活跃
},
},
{
path: "/ar",
name: "AR",
component: AR,
meta: {
title: "AR Paint", // 标题
keepAlive: false, // 是否保持活跃
},
},
{
path: "/arHit",
name: "ARHit",
component: ARHit,
meta: {
title: "AR Hit Test", // 标题
keepAlive: false, // 是否保持活跃
},
},
{
path: "/camera",
name: "Camera",
component: Camera,
meta: {
title: "camera test", // 标题
keepAlive: false, // 是否保持活跃
},
},
{
path: "/track",
name: "HandTrack",
component: HandTrack,
meta: {
title: "Hand Track", // 标题
keepAlive: false, // 是否保持活跃
},
},
{
path: "/video",
name: "Video",
component: Video,
meta: {
title: "Video", // 标题
keepAlive: false, // 是否保持活跃
},
},
// {
// path: "/example",
// name: "example",
// // route level code-splitting
// // this generates a separate chunk (about.[hash].js) for this route
// // which is lazy-loaded when the route is visited.
// component: () => import("../views/example.vue"),
// children: [
// // {
// // path: '/',
// // name: 'com1',
// // component: () =>
// // import(/* webpackChunkName: "com1" */ './components/com1.vue'),//像这样的 前面的注释内容是有用的可以指定chunk的名字
// // },
// ],
// meta: {
// keepAlive: false,
// },
// },
];
const router = new VueRouter({
mode: 'hash',
routes
})
// before守卫
router.beforeEach((to, from, next) => {
/* 路由发生变化修改页面title */
if (to.meta.title) {
document.title = to.meta.title
}
next()
})
export default router