mirror of https://gitee.com/pnoker/dc3-web.git
pull/1/head
parent
88372aced1
commit
9bba1fa55e
@ -1,73 +1,24 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import Home from '../views/Home.vue'
|
||||
import Things from '../views/Things.vue'
|
||||
import Template from '../views/Template.vue'
|
||||
import Now from '../views/Now.vue'
|
||||
import History from '../views/History.vue'
|
||||
import Alarm from '../views/Alarm.vue'
|
||||
import Label from '../views/Label.vue'
|
||||
import Picture from '../views/Picture.vue'
|
||||
import Video from '../views/Video.vue'
|
||||
import About from '../views/About.vue'
|
||||
import PageRouter from './page/'
|
||||
import ViewsRouter from './views/'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
let router = new VueRouter({
|
||||
scrollBehavior(to, from, savedPosition) {
|
||||
if (savedPosition) {
|
||||
return savedPosition
|
||||
} else {
|
||||
if (from.meta.keepAlive) {
|
||||
from.meta.savedPosition = document.body.scrollTop;
|
||||
}
|
||||
return {
|
||||
x: 0,
|
||||
y: to.meta.savedPosition || 0
|
||||
}
|
||||
}
|
||||
},
|
||||
routes: []
|
||||
});
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: '/things',
|
||||
name: 'things',
|
||||
component: Things
|
||||
},
|
||||
{
|
||||
path: '/template',
|
||||
name: 'template',
|
||||
component: Template
|
||||
},
|
||||
{
|
||||
path: '/now',
|
||||
name: 'now',
|
||||
component: Now
|
||||
},
|
||||
{
|
||||
path: '/history',
|
||||
name: 'history',
|
||||
component: History
|
||||
},
|
||||
{
|
||||
path: '/alarm',
|
||||
name: 'alarm',
|
||||
component: Alarm
|
||||
},
|
||||
{
|
||||
path: '/label',
|
||||
name: 'label',
|
||||
component: Label
|
||||
},
|
||||
{
|
||||
path: '/picture',
|
||||
name: 'picture',
|
||||
component: Picture
|
||||
},
|
||||
{
|
||||
path: '/video',
|
||||
name: 'video',
|
||||
component: Video
|
||||
},
|
||||
{
|
||||
path: '/about',
|
||||
name: 'about',
|
||||
component: About
|
||||
}
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
routes
|
||||
})
|
||||
router.addRoutes([...PageRouter, ...ViewsRouter]);
|
||||
|
||||
export default router
|
||||
|
Loading…
Reference in new issue