Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
ecfb702b
提交
ecfb702b
authored
11月 12, 2020
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: type error
上级
21e0548e
隐藏空白字符变更
内嵌
并排
正在显示
37 个修改的文件
包含
83 行增加
和
73 行删除
+83
-73
preserve.ts
build/script/preserve.ts
+1
-1
index.ts
build/vite/plugin/dynamicImport/index.ts
+1
-2
App.vue
src/App.vue
+1
-1
index.ts
src/components/ContextMenu/index.ts
+5
-5
Dropdown.tsx
src/components/Dropdown/Dropdown.tsx
+1
-0
ImportExcel.vue
src/components/Excel/src/ImportExcel.vue
+1
-1
FormItem.tsx
src/components/Form/src/FormItem.tsx
+2
-2
props.ts
src/components/Form/src/props.ts
+1
-1
BasicMenu.tsx
src/components/Menu/src/BasicMenu.tsx
+2
-2
util.ts
src/components/Scrollbar/src/util.ts
+1
-0
TableAction.tsx
src/components/Table/src/components/TableAction.tsx
+9
-2
const.ts
src/components/Table/src/const.ts
+1
-1
props.ts
src/components/Table/src/props.ts
+1
-1
table.ts
src/components/Table/src/types/table.ts
+2
-2
useEvent.ts
src/hooks/event/useEvent.ts
+1
-1
useWindowSize.ts
src/hooks/event/useWindowSize.ts
+0
-2
useLocalStorage.ts
src/hooks/web/useLocalStorage.ts
+1
-1
useMessage.tsx
src/hooks/web/useMessage.tsx
+1
-1
usePermission.ts
src/hooks/web/usePermission.ts
+1
-1
useSessionStorage.ts
src/hooks/web/useSessionStorage.ts
+1
-1
LayoutHeader.tsx
src/layouts/default/header/LayoutHeader.tsx
+1
-1
LockActionItem.tsx
src/layouts/default/header/LockActionItem.tsx
+1
-1
main.ts
src/main.ts
+2
-2
index.ts
src/router/menus/index.ts
+1
-3
types.d.ts
src/router/types.d.ts
+5
-3
permission.ts
src/setup/directives/permission.ts
+1
-1
permission.ts
src/store/modules/permission.ts
+1
-1
useApp.ts
src/useApp.ts
+5
-4
color.ts
src/utils/color.ts
+3
-3
env.ts
src/utils/env.ts
+0
-4
menuHelper.ts
src/utils/helper/menuHelper.ts
+2
-2
persistent.ts
src/utils/helper/persistent.ts
+1
-1
routeHelper.ts
src/utils/helper/routeHelper.ts
+22
-16
tsxHelper.tsx
src/utils/helper/tsxHelper.tsx
+1
-0
Axios.ts
src/utils/http/axios/Axios.ts
+1
-1
Storage.ts
src/utils/storage/Storage.ts
+1
-1
uuid.ts
src/utils/uuid.ts
+1
-1
没有找到文件。
build/script/preserve.ts
浏览文件 @
ecfb702b
...
...
@@ -25,7 +25,7 @@ export async function runPreserve() {
process
.
exit
(
1
);
}
fs
.
mkdirp
(
resolve
(
'build/.cache'
));
await
fs
.
mkdirp
(
resolve
(
'build/.cache'
));
function
checkPkgUpdate
()
{
const
pkg
=
require
(
'../../package.json'
);
const
{
dependencies
,
devDependencies
}
=
pkg
;
...
...
build/vite/plugin/dynamicImport/index.ts
浏览文件 @
ecfb702b
...
...
@@ -33,7 +33,7 @@ const dynamicImportTransform = function (env: any = {}): Transform {
try
{
const
files
=
glob
.
sync
(
'src/views/**/**.{vue,tsx}'
,
{
cwd
:
process
.
cwd
()
});
const
_code
=
`
return
`
export default function (id) {
switch (id) {
${
files
...
...
@@ -47,7 +47,6 @@ const dynamicImportTransform = function (env: any = {}): Transform {
}
}\n\n
`
;
return
_code
;
}
catch
(
error
)
{
console
.
error
(
error
);
return
code
;
...
...
src/App.vue
浏览文件 @
ecfb702b
<
template
>
<ConfigProvider
:locale=
"zhCN"
:transform
CellT
ext=
"transformCellText"
v-bind=
"lockOn"
>
<ConfigProvider
:locale=
"zhCN"
:transform
-cell-t
ext=
"transformCellText"
v-bind=
"lockOn"
>
<router-view
/>
</ConfigProvider>
</
template
>
...
...
src/components/ContextMenu/index.ts
浏览文件 @
ecfb702b
...
...
@@ -3,10 +3,10 @@ import { isClient } from '/@/utils/is';
import
{
Options
,
Props
}
from
'./src/types'
;
import
{
createVNode
,
render
}
from
'vue'
;
const
menuManager
:
{
dom
s
:
Element
[];
dom
List
:
Element
[];
resolve
:
Fn
;
}
=
{
dom
s
:
[],
dom
List
:
[],
resolve
:
()
=>
{},
};
export
const
createContextMenu
=
function
(
options
:
Options
)
{
...
...
@@ -32,9 +32,9 @@ export const createContextMenu = function (options: Options) {
const
bodyClick
=
function
()
{
menuManager
.
resolve
(
''
);
};
menuManager
.
dom
s
.
push
(
container
);
menuManager
.
dom
List
.
push
(
container
);
const
remove
=
function
()
{
menuManager
.
dom
s
.
forEach
((
dom
:
Element
)
=>
{
menuManager
.
dom
List
.
forEach
((
dom
:
Element
)
=>
{
try
{
document
.
body
.
removeChild
(
dom
);
}
catch
(
error
)
{}
...
...
@@ -55,7 +55,7 @@ export const createContextMenu = function (options: Options) {
export
const
unMountedContextMenu
=
function
()
{
if
(
menuManager
)
{
menuManager
.
resolve
(
''
);
menuManager
.
dom
s
=
[];
menuManager
.
dom
List
=
[];
}
};
...
...
src/components/Dropdown/Dropdown.tsx
浏览文件 @
ecfb702b
...
...
@@ -34,6 +34,7 @@ export default defineComponent({
</>
)
}
</
Menu
.
Item
>,
// @ts-ignore
divider
&&
<
Menu
.
Divider
key=
{
`d-${index}`
}
/>,
];
})
}
...
...
src/components/Excel/src/ImportExcel.vue
浏览文件 @
ecfb702b
...
...
@@ -96,7 +96,7 @@
// fix can't select the same excel
inputRefDom
.
value
=
''
;
}
readerData
(
rawFile
);
await
readerData
(
rawFile
);
}
/**
...
...
src/components/Form/src/FormItem.tsx
浏览文件 @
ecfb702b
...
...
@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
import
type
{
FormProps
}
from
'./types/form'
;
import
type
{
FormSchema
}
from
'./types/form'
;
import
type
{
ValidationRule
}
from
'ant-design-vue/lib/form/Form'
;
import
type
{
TableActionType
}
from
'
../../Table/src/types/t
able'
;
import
type
{
TableActionType
}
from
'
/@/components/T
able'
;
import
{
defineComponent
,
computed
,
unref
,
toRef
}
from
'vue'
;
import
{
Form
,
Col
}
from
'ant-design-vue'
;
...
...
@@ -16,7 +16,7 @@ import { upperFirst, cloneDeep } from 'lodash-es';
import
{
useItemLabelWidth
}
from
'./hooks/useLabelWidth'
;
import
{
ComponentType
}
from
'./types'
;
import
{
isNumber
}
from
'
../../..
/utils/is'
;
import
{
isNumber
}
from
'
/@
/utils/is'
;
export
default
defineComponent
({
name
:
'BasicFormItem'
,
...
...
src/components/Form/src/props.ts
浏览文件 @
ecfb702b
import
type
{
FieldMapToTime
,
FormSchema
}
from
'./types/form'
;
import
type
{
PropType
}
from
'vue'
;
import
type
{
ColEx
}
from
'./types'
;
import
{
TableActionType
}
from
'
../../Table/src/types/t
able'
;
import
{
TableActionType
}
from
'
/@/components/T
able'
;
export
const
basicProps
=
{
model
:
{
...
...
src/components/Menu/src/BasicMenu.tsx
浏览文件 @
ecfb702b
...
...
@@ -6,7 +6,7 @@ import { Menu } from 'ant-design-vue';
import
SearchInput
from
'./SearchInput.vue'
;
import
MenuContent
from
'./MenuContent'
;
import
{
MenuModeEnum
,
MenuTypeEnum
}
from
'/@/enums/menuEnum'
;
import
{
MenuModeEnum
,
MenuT
hemeEnum
,
MenuT
ypeEnum
}
from
'/@/enums/menuEnum'
;
import
{
menuStore
}
from
'/@/store/modules/menu'
;
import
{
appStore
}
from
'/@/store/modules/app'
;
...
...
@@ -255,7 +255,7 @@ export default defineComponent({
{
getSlot
(
slots
,
'header'
)
}
<
SearchInput
class=
{
!
props
.
search
?
'hidden'
:
''
}
theme=
{
props
.
theme
}
theme=
{
props
.
theme
as
MenuThemeEnum
}
onChange=
{
handleInputChange
}
onClick=
{
handleInputClick
}
collapsed=
{
getCollapsedState
}
...
...
src/components/Scrollbar/src/util.ts
浏览文件 @
ecfb702b
...
...
@@ -22,6 +22,7 @@ export const BAR_MAP: BarMap = {
},
};
// @ts-ignore
export
function
renderThumbStyle
({
move
,
size
,
bar
})
{
const
style
=
{}
as
any
;
const
translate
=
`translate
${
bar
.
axis
}
(
${
move
}
%)`
;
...
...
src/components/Table/src/components/TableAction.tsx
浏览文件 @
ecfb702b
...
...
@@ -2,7 +2,7 @@ import { defineComponent, PropType } from 'vue';
import
{
Dropdown
,
Menu
,
Popconfirm
}
from
'ant-design-vue'
;
import
Icon
from
'/@/components/Icon/index'
;
import
{
DownOutlined
}
from
'@ant-design/icons-vue'
;
import
{
ActionItem
}
from
'
../types/tableAction
'
;
import
{
ActionItem
}
from
'
/@/components/Table
'
;
import
Button
from
'/@/components/Button/index.vue'
;
const
prefixCls
=
'basic-table-action'
;
export
default
defineComponent
({
...
...
@@ -26,7 +26,14 @@ export default defineComponent({
function
renderButton
(
action
:
ActionItem
,
index
:
number
)
{
const
{
disabled
=
false
,
label
,
icon
,
color
=
''
,
type
=
'link'
}
=
action
;
const
button
=
(
<
Button
type=
{
type
}
size=
"small"
disabled=
{
disabled
}
color=
{
color
}
{
...
action
}
key=
{
index
}
>
<
Button
type=
{
type
as
any
}
size=
"small"
disabled=
{
disabled
}
color=
{
color
}
{
...
action
}
key=
{
index
}
>
{
()
=>
(
<>
{
label
}
...
...
src/components/Table/src/const.ts
浏览文件 @
ecfb702b
...
...
@@ -22,7 +22,7 @@ export const FETCH_SETTING = {
};
// 配置通用排序函数
export
function
DEFAULT_SORT_FN
(
sortInfo
:
SorterResult
<
any
>
)
{
export
function
DEFAULT_SORT_FN
(
sortInfo
:
SorterResult
)
{
const
{
field
,
order
}
=
sortInfo
;
return
{
// 传给后台的排序字段你
...
...
src/components/Table/src/props.ts
浏览文件 @
ecfb702b
...
...
@@ -8,7 +8,7 @@ import type {
TableCustomRecord
,
TableRowSelection
,
}
from
'./types/table'
;
import
type
{
FormProps
}
from
'/@/components/Form
/index
'
;
import
type
{
FormProps
}
from
'/@/components/Form'
;
import
{
DEFAULT_SORT_FN
,
FETCH_SETTING
}
from
'./const'
;
// 注释看 types/table
...
...
src/components/Table/src/types/table.ts
浏览文件 @
ecfb702b
import
type
{
VNodeChild
}
from
'vue'
;
import
type
{
PaginationProps
}
from
'./pagination'
;
import
type
{
FormProps
}
from
'/@/components/Form
/index
'
;
import
type
{
FormProps
}
from
'/@/components/Form'
;
import
type
{
ColumnProps
,
TableRowSelection
as
ITableRowSelection
,
...
...
@@ -125,7 +125,7 @@ export interface TableSetting {
export
interface
BasicTableProps
<
T
=
any
>
{
// 自定义排序方法
sortFn
?:
(
sortInfo
:
SorterResult
<
any
>
)
=>
any
;
sortFn
?:
(
sortInfo
:
SorterResult
)
=>
any
;
// 显示表格设置
showTableSetting
?:
boolean
;
tableSetting
?:
TableSetting
;
...
...
src/hooks/event/useEvent.ts
浏览文件 @
ecfb702b
...
...
@@ -41,7 +41,7 @@ export function useEvent({
const
removeWatch
=
watch
(
element
,
(
v
,
ov
,
cleanUp
)
=>
{
(
v
,
_
ov
,
cleanUp
)
=>
{
if
(
v
)
{
!
unref
(
isAddRef
)
&&
addEventListener
(
v
);
cleanUp
(()
=>
{
...
...
src/hooks/event/useWindowSize.ts
浏览文件 @
ecfb702b
import
type
{
Fn
}
from
'./types'
;
import
{
tryOnMounted
,
tryOnUnmounted
}
from
'/@/utils/helper/vueHelper'
;
import
{
ref
}
from
'vue'
;
...
...
src/hooks/web/useLocalStorage.ts
浏览文件 @
ecfb702b
import
{
createStorage
}
from
'/@/utils/storage
/index
'
;
import
{
createStorage
}
from
'/@/utils/storage'
;
export
function
useLocalStorage
()
{
return
createStorage
(
localStorage
);
...
...
src/hooks/web/useMessage.tsx
浏览文件 @
ecfb702b
import
type
{
ModalFunc
,
ModalFuncProps
}
from
'ant-design-vue/lib/modal/Modal'
;
import
type
{
MessageApi
}
from
'ant-design-vue/lib/message
/index
'
;
import
type
{
MessageApi
}
from
'ant-design-vue/lib/message'
;
import
type
{
VNodeTypes
,
CSSProperties
}
from
'vue'
;
import
{
Modal
,
message
as
Message
,
notification
}
from
'ant-design-vue'
;
...
...
src/hooks/web/usePermission.ts
浏览文件 @
ecfb702b
import
{
appStore
}
from
'
./../..
/store/modules/app'
;
import
{
appStore
}
from
'
/@
/store/modules/app'
;
import
{
permissionStore
}
from
'/@/store/modules/permission'
;
import
{
useTabs
}
from
'./useTabs'
;
import
{
RoleEnum
}
from
'/@/enums/roleEnum'
;
...
...
src/hooks/web/useSessionStorage.ts
浏览文件 @
ecfb702b
import
{
createStorage
}
from
'/@/utils/storage
/index
'
;
import
{
createStorage
}
from
'/@/utils/storage'
;
export
function
useSessionStorage
()
{
return
createStorage
(
sessionStorage
);
...
...
src/layouts/default/header/LayoutHeader.tsx
浏览文件 @
ecfb702b
...
...
@@ -21,7 +21,7 @@ import { useFullscreen } from '/@/hooks/web/useFullScreen';
import
{
useTabs
}
from
'/@/hooks/web/useTabs'
;
import
{
useWindowSizeFn
}
from
'/@/hooks/event/useWindowSize'
;
import
{
useRouter
}
from
'vue-router'
;
import
{
useModal
}
from
'/@/components/Modal
/index
'
;
import
{
useModal
}
from
'/@/components/Modal'
;
import
{
appStore
}
from
'/@/store/modules/app'
;
import
{
errorStore
}
from
'/@/store/modules/error'
;
...
...
src/layouts/default/header/LockActionItem.tsx
浏览文件 @
ecfb702b
...
...
@@ -54,7 +54,7 @@ export default defineComponent({
isLock
:
true
,
pwd
:
password
,
});
resetFields
();
await
resetFields
();
}
catch
(
error
)
{}
}
// 账号密码登录
...
...
src/main.ts
浏览文件 @
ecfb702b
...
...
@@ -3,8 +3,8 @@ import { createApp } from 'vue';
import
router
,
{
setupRouter
}
from
'/@/router'
;
import
{
setupStore
}
from
'/@/store'
;
import
{
setupAntd
}
from
'/@/setup/ant-design-vue'
;
import
{
setupErrorHandle
}
from
'/@/setup/error-handle
/index
'
;
import
{
setupDirectives
}
from
'/@/setup/directives
/index
'
;
import
{
setupErrorHandle
}
from
'/@/setup/error-handle'
;
import
{
setupDirectives
}
from
'/@/setup/directives'
;
import
{
isDevMode
,
isProdMode
,
isUseMock
}
from
'/@/utils/env'
;
import
{
setupProdMockServer
}
from
'../mock/_createProductionServer'
;
...
...
src/router/menus/index.ts
浏览文件 @
ecfb702b
...
...
@@ -91,9 +91,7 @@ function basicFilter(routes: RouteRecordNormalized[]) {
if
(
route
.
meta
.
carryParam
)
{
return
pathToRegexp
(
route
.
path
).
test
(
menu
.
path
);
}
if
(
route
.
meta
.
ignoreAuth
)
{
return
false
;
}
if
(
route
.
meta
.
ignoreAuth
)
return
false
;
}
return
route
.
path
===
menu
.
path
;
});
...
...
src/router/types.d.ts
浏览文件 @
ecfb702b
...
...
@@ -73,9 +73,11 @@ export interface MenuModule {
menu
:
Menu
;
}
export
interface
App
RouteModule
{
layout
?
:
AppRouteRecordRaw
;
routes
?
:
AppRouteRecordRaw
[];
interface
RouteModule
{
layout
:
AppRouteRecordRaw
;
routes
:
AppRouteRecordRaw
[];
children
?:
AppRouteRecordRaw
[];
component
?:
any
;
}
export
type
AppRouteModule
=
RouteModule
|
AppRouteRecordRaw
;
src/setup/directives/permission.ts
浏览文件 @
ecfb702b
import
{
appStore
}
from
'
./../..
/store/modules/app'
;
import
{
appStore
}
from
'
/@
/store/modules/app'
;
import
type
{
App
}
from
'vue'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
{
PermissionModeEnum
}
from
'/@/enums/appEnum'
;
...
...
src/store/modules/permission.ts
浏览文件 @
ecfb702b
...
...
@@ -10,7 +10,7 @@ import { PermissionModeEnum } from '/@/enums/appEnum';
import
{
appStore
}
from
'/@/store/modules/app'
;
import
{
userStore
}
from
'/@/store/modules/user'
;
import
{
asyncRoutes
}
from
'/@/router/routes
/index
'
;
import
{
asyncRoutes
}
from
'/@/router/routes'
;
import
{
filter
}
from
'/@/utils/helper/treeHelper'
;
import
{
toRaw
}
from
'vue'
;
import
{
getMenuListById
}
from
'/@/api/sys/menu'
;
...
...
src/useApp.ts
浏览文件 @
ecfb702b
...
...
@@ -93,10 +93,11 @@ export function useListenerNetWork() {
// Check network status
useNetWork
({
onLineFn
:
()
=>
{
replace
(
PageEnum
.
BASE_HOME
);
useTimeout
(()
=>
{
appStore
.
commitPageLoadingState
(
false
);
},
300
);
replace
(
PageEnum
.
BASE_HOME
).
then
(()
=>
{
useTimeout
(()
=>
{
appStore
.
commitPageLoadingState
(
false
);
},
200
);
});
},
offLineFn
:
()
=>
{
replace
({
...
...
src/utils/color.ts
浏览文件 @
ecfb702b
...
...
@@ -14,10 +14,10 @@ export const isHexColor = function (color: string) {
* RGB 颜色值转换为 十六进制颜色值.
* r, g, 和 b 需要在 [0, 255] 范围内
*
* @param Number r 红色色值
* @param Number g 绿色色值
* @param Number b 蓝色色值
* @return String 类似#ff00ff
* @param r
* @param g
* @param b
*/
export
const
rgbToHex
=
function
(
r
:
number
,
g
:
number
,
b
:
number
)
{
// tslint:disable-next-line:no-bitwise
...
...
src/utils/env.ts
浏览文件 @
ecfb702b
...
...
@@ -17,7 +17,6 @@ export const prodMode = 'production';
/**
* @description: 获取环境变量
* @param {type}
* @returns:
* @example:
*/
...
...
@@ -25,7 +24,6 @@ export const getEnv = (): string => import.meta.env.MODE;
/**
* @description: 是否是开发模式
* @param {type}
* @returns:
* @example:
*/
...
...
@@ -33,7 +31,6 @@ export const isDevMode = (): boolean => import.meta.env.DEV;
/**
* @description: 是否是生产模式模式
* @param {type}
* @returns:
* @example:
*/
...
...
@@ -41,7 +38,6 @@ export const isProdMode = (): boolean => import.meta.env.PROD;
/**
* @description: 是否开启mock
* @param {type}
* @returns:
* @example:
*/
...
...
src/utils/helper/menuHelper.ts
浏览文件 @
ecfb702b
import
{
AppRouteModule
}
from
'/@/router/types.d'
;
import
{
AppRouteModule
,
RouteModule
}
from
'/@/router/types.d'
;
import
type
{
MenuModule
,
Menu
,
AppRouteRecordRaw
}
from
'/@/router/types'
;
import
{
findPath
,
forEach
,
treeMap
,
treeToList
}
from
'./treeHelper'
;
...
...
@@ -48,7 +48,7 @@ export function transformRouteToMenu(routeModList: AppRouteModule[]) {
const
cloneRouteModList
=
cloneDeep
(
routeModList
);
const
routeList
:
AppRouteRecordRaw
[]
=
[];
cloneRouteModList
.
forEach
((
item
)
=>
{
const
{
layout
,
routes
,
children
}
=
item
;
const
{
layout
,
routes
,
children
}
=
item
as
RouteModule
;
if
(
layout
)
{
layout
.
children
=
routes
||
children
;
routeList
.
push
(
layout
);
...
...
src/utils/helper/persistent.ts
浏览文件 @
ecfb702b
import
{
createStorage
}
from
'/@/utils/storage
/index
'
;
import
{
createStorage
}
from
'/@/utils/storage'
;
import
{
isIeFn
}
from
'/@/utils/browser'
;
import
{
BASE_LOCAL_CACHE_KEY
,
BASE_SESSION_CACHE_KEY
}
from
'/@/enums/cacheEnum'
;
...
...
src/utils/helper/routeHelper.ts
浏览文件 @
ecfb702b
import
type
{
AppRouteModule
,
AppRouteRecordRaw
}
from
'/@/router/types'
;
import
type
{
AppRouteModule
,
AppRouteRecordRaw
,
RouteModule
}
from
'/@/router/types'
;
import
type
{
RouteLocationNormalized
,
RouteRecordRaw
}
from
'vue-router'
;
import
{
createRouter
,
createWebHashHistory
}
from
'vue-router'
;
import
{
appStore
}
from
'/@/store/modules/app'
;
import
{
tabStore
}
from
'/@/store/modules/tab'
;
import
{
createRouter
,
createWebHashHistory
}
from
'vue-router'
;
import
{
toRaw
}
from
'vue'
;
import
{
PAGE_LAYOUT_COMPONENT
}
from
'/@/router/constant'
;
// import { isDevMode } from '/@/utils/env';
...
...
@@ -21,17 +21,17 @@ export function setCurrentTo(to: RouteLocationNormalized) {
}
// 转化路由模块
// 将多级转成2层。keepAlive问题
export
function
genRouteModule
(
moduleList
:
AppRouteModule
[])
{
export
function
genRouteModule
(
moduleList
:
AppRouteModule
[]
|
AppRouteRecordRaw
[]
)
{
const
ret
:
AppRouteRecordRaw
[]
=
[];
for
(
const
routeMod
of
moduleList
)
{
let
routes
=
[];
let
routes
:
RouteRecordRaw
[]
=
[];
let
layout
:
AppRouteRecordRaw
|
undefined
;
if
(
Reflect
.
has
(
routeMod
,
'routes'
))
{
routes
=
routeMod
.
routes
as
any
;
layout
=
routeMod
.
layout
;
routes
=
(
routeMod
as
RouteModule
)
.
routes
as
any
;
layout
=
(
routeMod
as
RouteModule
)
.
layout
;
}
else
if
(
Reflect
.
has
(
routeMod
,
'path'
))
{
layout
=
omit
(
routeMod
,
'children'
)
as
any
;
routes
=
routeMod
.
children
||
[]
;
routes
=
(
routeMod
.
children
as
RouteRecordRaw
[])
||
([]
as
RouteRecordRaw
[])
;
}
const
router
=
createRouter
({
routes
,
history
:
createWebHashHistory
()
});
...
...
@@ -66,20 +66,26 @@ function asyncImportRoute(routes: AppRouteRecordRaw[] | undefined) {
});
}
function
getLayoutComp
(
comp
:
string
)
{
return
comp
===
'PAGE_LAYOUT'
?
PAGE_LAYOUT_COMPONENT
:
''
;
}
// 将后台对象转成路由对象
export
function
transformObjToRoute
(
routeList
:
AppRouteModule
[])
{
export
function
transformObjToRoute
<
T
=
any
>
(
routeList
:
AppRouteModule
[]):
T
[]
{
routeList
.
forEach
((
route
)
=>
{
asyncImportRoute
(
Reflect
.
has
(
route
,
'routes'
)
?
route
.
routes
:
route
.
children
||
[]);
if
(
route
.
layout
)
{
route
.
layout
.
component
=
route
.
layout
.
component
===
'PAGE_LAYOUT'
?
PAGE_LAYOUT_COMPONENT
:
''
;
asyncImportRoute
(
Reflect
.
has
(
route
,
'routes'
)
?
(
route
as
RouteModule
).
routes
:
route
.
children
||
[]
);
if
((
route
as
RouteModule
).
layout
)
{
(
route
as
RouteModule
).
layout
.
component
=
getLayoutComp
(
(
route
as
RouteModule
).
layout
.
component
);
}
else
{
route
.
component
=
route
.
component
===
'PAGE_LAYOUT'
?
PAGE_LAYOUT_COMPONENT
:
''
;
const
_layout
=
omit
(
route
,
'children'
)
as
any
;
route
.
layout
=
_layout
;
route
.
component
=
getLayoutComp
(
route
.
component
);
(
route
as
RouteModule
).
layout
=
omit
(
route
,
'children'
)
as
any
;
}
});
return
routeList
;
return
(
routeList
as
unknown
)
as
T
[]
;
}
//
...
...
src/utils/helper/tsxHelper.tsx
浏览文件 @
ecfb702b
...
...
@@ -20,6 +20,7 @@ export function getSlot(slots: Slots, slot = 'default', data?: any) {
/**
* extends slots
* @param slots
* @param excludeKeys
*/
export
function
extendSlots
(
slots
:
Slots
,
excludeKeys
:
string
[]
=
[])
{
const
slotKeys
=
Object
.
keys
(
slots
);
...
...
src/utils/http/axios/Axios.ts
浏览文件 @
ecfb702b
...
...
@@ -17,7 +17,7 @@ export * from './axiosTransform';
*/
export
class
VAxios
{
private
axiosInstance
:
AxiosInstance
;
private
options
:
CreateAxiosOptions
;
private
readonly
options
:
CreateAxiosOptions
;
constructor
(
options
:
CreateAxiosOptions
)
{
this
.
options
=
options
;
...
...
src/utils/storage/Storage.ts
浏览文件 @
ecfb702b
...
...
@@ -92,7 +92,7 @@ export const createStorage = ({ prefixKey = '', storage = sessionStorage } = {})
* 添加cookie
* @param name cookie名字
* @param value cookie内容
* @param
day 过期时间
* @param
expire
* 如果过期时间未设置,默认管理浏览器自动删除
* 例子:
* cookieData.set('name','value',)
...
...
src/utils/uuid.ts
浏览文件 @
ecfb702b
...
...
@@ -10,7 +10,7 @@ export function buildUUID(): string {
}
else
if
(
i
===
15
)
{
uuid
+=
4
;
}
else
if
(
i
===
20
)
{
uuid
+=
hexList
[(
Math
.
random
()
*
4
)
|
(
0
+
8
)
];
uuid
+=
hexList
[(
Math
.
random
()
*
4
)
|
8
];
}
else
{
uuid
+=
hexList
[(
Math
.
random
()
*
16
)
|
0
];
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论