mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
fix: routes mets typed
Signed-off-by: Kaifuny <superbiger.github@gmail.com>
This commit is contained in:
parent
14c00a9081
commit
0e183c2b5f
13
contact-frontend/packages/modules/services/auth/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/auth/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
13
contact-frontend/packages/modules/services/chat/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/chat/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
13
contact-frontend/packages/modules/services/dashboard/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/dashboard/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
13
contact-frontend/packages/modules/services/enterprise/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/enterprise/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
13
contact-frontend/packages/modules/services/organization/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/organization/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
13
contact-frontend/packages/modules/services/seats/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/seats/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
13
contact-frontend/packages/modules/services/setting/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/setting/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
@ -35,7 +35,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
{
|
{
|
||||||
path: 'social',
|
path: 'social',
|
||||||
name: ROUTE_NAME.SYSTEM_SOCIAL_INDEX,
|
name: ROUTE_NAME.SYSTEM_SOCIAL_INDEX,
|
||||||
component: () => import('../views/HomeView.vue'),
|
component: () => import('../views/AuthenticatorView.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '认证登录',
|
title: '认证登录',
|
||||||
requiresAuth: true,
|
requiresAuth: true,
|
||||||
|
13
contact-frontend/packages/modules/services/system/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/system/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<div>调整登录</div>
|
||||||
|
</template>
|
13
contact-frontend/packages/modules/services/work-order/src/shims-vue-routes.d.ts
vendored
Normal file
13
contact-frontend/packages/modules/services/work-order/src/shims-vue-routes.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
import { Component } from 'vue'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
// 是可选的
|
||||||
|
icon?: Component,
|
||||||
|
comingSoon?: boolean
|
||||||
|
|
||||||
|
// 每个路由都必须声明
|
||||||
|
requiresAuth: boolean
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import { MenuOption, NIcon } from 'naive-ui'
|
import { MenuOption, NIcon } from 'naive-ui'
|
||||||
import { Component, h } from 'vue'
|
import { Component, h } from 'vue'
|
||||||
import { RouteRecordRaw } from 'vue-router'
|
import { RouteRecordRaw, RouterLink } from 'vue-router'
|
||||||
|
|
||||||
function renderIcon(icon?: Component) {
|
function renderIcon(icon?: Component) {
|
||||||
if (icon) {
|
if (icon) {
|
||||||
@ -18,14 +18,32 @@ export function routesToMenus(
|
|||||||
array.forEach((route: RouteRecordRaw) => {
|
array.forEach((route: RouteRecordRaw) => {
|
||||||
if (route.children) {
|
if (route.children) {
|
||||||
result.push({
|
result.push({
|
||||||
label: route.meta?.title,
|
label: h(
|
||||||
|
RouterLink,
|
||||||
|
{
|
||||||
|
to: {
|
||||||
|
name: route.name,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ default: () => route.meta?.title as string }
|
||||||
|
),
|
||||||
|
title: route.meta?.title,
|
||||||
key: route.path,
|
key: route.path,
|
||||||
icon: renderIcon(route.meta?.icon),
|
icon: renderIcon(route.meta?.icon),
|
||||||
children: routesToMenus(route.children, true),
|
children: routesToMenus(route.children, true),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
result.push({
|
result.push({
|
||||||
label: route.meta?.title,
|
label: h(
|
||||||
|
RouterLink,
|
||||||
|
{
|
||||||
|
to: {
|
||||||
|
name: route.name,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ default: () => route.meta?.title as string }
|
||||||
|
),
|
||||||
|
title: route.meta?.title,
|
||||||
key: route.name as string,
|
key: route.name as string,
|
||||||
icon: renderIcon(route.meta?.icon),
|
icon: renderIcon(route.meta?.icon),
|
||||||
disabled: route.meta?.disabled as boolean,
|
disabled: route.meta?.disabled as boolean,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user