refactor(modules/web): Mirgrat to typescript; fix bugs
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
import { createWebHashHistory, createRouter } from "vue-router";
|
||||
|
||||
export const bookRoutes = [
|
||||
{
|
||||
path: "/",
|
||||
name: "shelf",
|
||||
component: () => import("../views/BookShelf.vue"),
|
||||
},
|
||||
{
|
||||
path: "/chapter",
|
||||
name: "chapter",
|
||||
component: () => import("../views/BookChapter.vue"),
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
// mode: "history",
|
||||
history: createWebHashHistory(),
|
||||
// @ts-ignore
|
||||
routes: bookRoutes,
|
||||
});
|
||||
|
||||
export default router;
|
||||
@@ -0,0 +1,22 @@
|
||||
import { createWebHashHistory, createRouter } from 'vue-router'
|
||||
|
||||
export const bookRoutes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'shelf',
|
||||
component: () => import('../views/BookShelf.vue'),
|
||||
},
|
||||
{
|
||||
path: '/chapter',
|
||||
name: 'chapter',
|
||||
component: () => import('../views/BookChapter.vue'),
|
||||
},
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
// mode: "history",
|
||||
history: createWebHashHistory(),
|
||||
routes: bookRoutes,
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -1,15 +0,0 @@
|
||||
import { createWebHashHistory, createRouter } from "vue-router";
|
||||
import { bookRoutes } from "./bookRouter";
|
||||
import { sourceRoutes } from "./sourceRouter";
|
||||
|
||||
const router = createRouter({
|
||||
// history: createWebHistory(process.env.BASE_URL),
|
||||
history: createWebHashHistory(),
|
||||
// @ts-ignore
|
||||
routes: bookRoutes.concat(sourceRoutes),
|
||||
});
|
||||
|
||||
router.afterEach((to) => {
|
||||
if (to.name == "shelf") document.title = "书架";
|
||||
});
|
||||
export default router;
|
||||
@@ -0,0 +1,14 @@
|
||||
import { createWebHashHistory, createRouter } from 'vue-router'
|
||||
import { bookRoutes } from './bookRouter'
|
||||
import { sourceRoutes } from './sourceRouter'
|
||||
|
||||
const router = createRouter({
|
||||
// history: createWebHistory(process.env.BASE_URL),
|
||||
history: createWebHashHistory(),
|
||||
routes: [bookRoutes, sourceRoutes].flat(),
|
||||
})
|
||||
|
||||
router.afterEach(to => {
|
||||
if (to.name == 'shelf') document.title = '书架'
|
||||
})
|
||||
export default router
|
||||
@@ -1,23 +1,23 @@
|
||||
import sourceEditor from "../views/SourceEditor.vue";
|
||||
import { createWebHashHistory, createRouter } from "vue-router";
|
||||
import sourceEditor from '../views/SourceEditor.vue'
|
||||
import { createWebHashHistory, createRouter } from 'vue-router'
|
||||
|
||||
export const sourceRoutes = [
|
||||
{
|
||||
path: "/bookSource",
|
||||
name: "book-home",
|
||||
path: '/bookSource',
|
||||
name: 'book-home',
|
||||
component: sourceEditor,
|
||||
},
|
||||
{
|
||||
path: "/rssSource",
|
||||
name: "rss-home",
|
||||
path: '/rssSource',
|
||||
name: 'rss-home',
|
||||
component: sourceEditor,
|
||||
},
|
||||
];
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
// history: createWebHistory(process.env.BASE_URL),
|
||||
history: createWebHashHistory(),
|
||||
routes: sourceRoutes,
|
||||
});
|
||||
})
|
||||
|
||||
export default router;
|
||||
export default router
|
||||
Reference in New Issue
Block a user