KawAnime/router/index.js

37 lines
875 B
JavaScript
Raw Normal View History

import Vue from 'vue'
import Router from 'vue-router'
// The meta data for your routes
const meta = require('./meta.js')
// Function to create routes
// Is default lazy but can be changed
function route (path, view) {
return {
path: path,
meta: meta[path],
component: resolve => import(`pages/${view}.vue`).then(resolve)
}
}
Vue.use(Router)
export function createRouter () {
return new Router({
base: __dirname,
mode: 'history',
scrollBehavior: () => ({y: 0}),
routes: [
2017-09-17 19:13:25 +00:00
route('/', 'releases'),
route('/downloader', 'downloader'),
route('/seasons', 'seasons'),
route('/news', 'news'),
route('/localPage', 'localPage'),
route('/watchList', 'watchList'),
route('/malPage', 'malPage'),
// Global redirect for 404
{path: '*', redirect: '/'} // TODO: make a custom 404 page
]
})
}