发布 0.2.1 并完善工具边界与安全性
This commit is contained in:
+4
-4
@@ -15,20 +15,20 @@ const toolRoutes: RouteRecordRaw[] = tools.map((tool) => ({
|
||||
export const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{ path: '/', redirect: '/tools/ascii-hex' },
|
||||
{ path: '/', redirect: '/tools/utf8-hex' },
|
||||
...toolRoutes,
|
||||
{
|
||||
path: '/setting',
|
||||
path: '/tools/setting',
|
||||
name: 'setting',
|
||||
component: () => import('@/views/SettingView.vue'),
|
||||
meta: { title: '工具管理' },
|
||||
},
|
||||
{ path: '/:pathMatch(.*)*', redirect: '/tools/ascii-hex' },
|
||||
{ path: '/:pathMatch(.*)*', redirect: '/tools/utf8-hex' },
|
||||
],
|
||||
scrollBehavior: () => ({ top: 0 }),
|
||||
})
|
||||
|
||||
router.beforeEach((to) => {
|
||||
if (to.meta.toolId && !toolById.has(String(to.meta.toolId))) return '/tools/ascii-hex'
|
||||
if (to.meta.toolId && !toolById.has(String(to.meta.toolId))) return '/tools/utf8-hex'
|
||||
return true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user