This commit is contained in:
syuilo
2020-07-23 23:39:15 +09:00
parent a003c3f7e9
commit d35f90b36d
6 changed files with 42 additions and 56 deletions

View File

@@ -1,15 +1,12 @@
import Vue from 'vue';
import VueRouter from 'vue-router';
import { createRouter, createWebHistory } from 'vue-router';
import MkIndex from './pages/index.vue';
Vue.use(VueRouter);
const page = (path: string) => () => import(`./pages/${path}.vue`).then(m => m.default);
let indexScrollPos = 0;
export const router = new VueRouter({
mode: 'history',
export const router = new createRouter({
history: createWebHistory(),
routes: [
{ path: '/', name: 'index', component: MkIndex },
{ path: '/@:user', name: 'user', component: page('user/index'), children: [
@@ -67,7 +64,7 @@ export const router = new VueRouter({
{ path: '/miauth/:session', component: page('miauth') },
{ path: '/authorize-follow', component: page('follow') },
{ path: '/share', component: page('share') },
{ path: '*', component: page('not-found') }
{ path: '/:catchAll(.*)', component: page('not-found') }
],
// なんかHacky
// 通常の使い方をすると scroll メソッドの behavior を設定できないため、自前で window.scroll するようにする