Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
嘉然大魔玉
vue-vben-admin
提交
fa18365c
V
vue-vben-admin
项目概览
嘉然大魔玉
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fa18365c
编写于
4月 06, 2023
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 移除 useTimeoutFn文件,使用 vueuse
上级
feadf64e
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
48 addition
and
93 deletion
+48
-93
packages/hooks/src/index.ts
packages/hooks/src/index.ts
+2
-0
src/components/Container/src/LazyContainer.vue
src/components/Container/src/LazyContainer.vue
+1
-1
src/components/Container/src/collapse/CollapseContainer.vue
src/components/Container/src/collapse/CollapseContainer.vue
+1
-1
src/components/Menu/src/useOpenKeys.ts
src/components/Menu/src/useOpenKeys.ts
+18
-19
src/components/Modal/src/hooks/useModalDrag.ts
src/components/Modal/src/hooks/useModalDrag.ts
+1
-1
src/components/SimpleMenu/src/useOpenKeys.ts
src/components/SimpleMenu/src/useOpenKeys.ts
+21
-22
src/components/Table/src/hooks/useDataSource.ts
src/components/Table/src/hooks/useDataSource.ts
+1
-1
src/components/Verify/src/DragVerify.vue
src/components/Verify/src/DragVerify.vue
+1
-1
src/components/Verify/src/ImgRotate.vue
src/components/Verify/src/ImgRotate.vue
+1
-1
src/hooks/core/useTimeout.ts
src/hooks/core/useTimeout.ts
+0
-45
src/hooks/web/useECharts.ts
src/hooks/web/useECharts.ts
+1
-1
未找到文件。
packages/hooks/src/index.ts
浏览文件 @
fa18365c
export
*
from
'
./onMountedOrActivated
'
;
export
*
from
'
./useAttrs
'
;
export
*
from
'
./useRefs
'
;
export
{
useTimeoutFn
}
from
'
@vueuse/core
'
;
src/components/Container/src/LazyContainer.vue
浏览文件 @
fa18365c
...
...
@@ -19,8 +19,8 @@
<
script
lang=
"ts"
>
import
type
{
PropType
}
from
'
vue
'
;
import
{
defineComponent
,
reactive
,
onMounted
,
ref
,
toRef
,
toRefs
}
from
'
vue
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
import
{
Skeleton
}
from
'
ant-design-vue
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useIntersectionObserver
}
from
'
/@/hooks/event/useIntersectionObserver
'
;
interface
State
{
...
...
src/components/Container/src/collapse/CollapseContainer.vue
浏览文件 @
fa18365c
...
...
@@ -2,10 +2,10 @@
import
{
ref
,
unref
,
defineComponent
,
type
PropType
,
type
ExtractPropTypes
}
from
'
vue
'
;
import
{
isNil
}
from
'
lodash-es
'
;
import
{
Skeleton
}
from
'
ant-design-vue
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
import
{
CollapseTransition
}
from
'
/@/components/Transition
'
;
import
CollapseHeader
from
'
./CollapseHeader.vue
'
;
import
{
triggerWindowResize
}
from
'
/@/utils/event
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useDesign
}
from
'
/@/hooks/web/useDesign
'
;
const
collapseContainerProps
=
{
...
...
src/components/Menu/src/useOpenKeys.ts
浏览文件 @
fa18365c
import
{
MenuModeEnum
}
from
'
/@/enums/menuEnum
'
;
import
type
{
Menu
as
MenuType
}
from
'
/@/router/types
'
;
import
type
{
MenuState
}
from
'
./types
'
;
import
{
computed
,
Ref
,
toRaw
,
unref
}
from
'
vue
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
import
{
uniq
}
from
'
lodash-es
'
;
import
{
useMenuSetting
}
from
'
/@/hooks/setting/useMenuSetting
'
;
import
{
getAllParentPath
}
from
'
/@/router/helper/menuHelper
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
export
function
useOpenKeys
(
menuState
:
MenuState
,
...
...
@@ -22,22 +20,23 @@ export function useOpenKeys(
return
;
}
const
native
=
unref
(
getIsMixSidebar
);
useTimeoutFn
(
()
=>
{
const
menuList
=
toRaw
(
menus
.
value
);
if
(
menuList
?.
length
===
0
)
{
menuState
.
openKeys
=
[];
return
;
}
if
(
!
unref
(
accordion
))
{
menuState
.
openKeys
=
uniq
([...
menuState
.
openKeys
,
...
getAllParentPath
(
menuList
,
path
)]);
}
else
{
menuState
.
openKeys
=
getAllParentPath
(
menuList
,
path
);
}
},
16
,
!
native
,
);
const
handle
=
()
=>
{
const
menuList
=
toRaw
(
menus
.
value
);
if
(
menuList
?.
length
===
0
)
{
menuState
.
openKeys
=
[];
return
;
}
if
(
!
unref
(
accordion
))
{
menuState
.
openKeys
=
uniq
([...
menuState
.
openKeys
,
...
getAllParentPath
(
menuList
,
path
)]);
}
else
{
menuState
.
openKeys
=
getAllParentPath
(
menuList
,
path
);
}
};
if
(
native
)
{
handle
();
}
else
{
useTimeoutFn
(
handle
,
16
);
}
}
const
getOpenKeys
=
computed
(()
=>
{
...
...
src/components/Modal/src/hooks/useModalDrag.ts
浏览文件 @
fa18365c
import
{
Ref
,
unref
,
watchEffect
}
from
'
vue
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
export
interface
UseModalDragMoveContext
{
draggable
:
Ref
<
boolean
>
;
...
...
src/components/SimpleMenu/src/useOpenKeys.ts
浏览文件 @
fa18365c
import
type
{
Menu
as
MenuType
}
from
'
/@/router/types
'
;
import
type
{
MenuState
}
from
'
./types
'
;
import
{
computed
,
Ref
,
toRaw
,
unref
}
from
'
vue
'
;
import
{
uniq
}
from
'
lodash-es
'
;
import
{
getAllParentPath
}
from
'
/@/router/helper/menuHelper
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
import
{
useDebounceFn
}
from
'
@vueuse/core
'
;
export
function
useOpenKeys
(
...
...
@@ -20,25 +17,27 @@ export function useOpenKeys(
async
function
setOpenKeys
(
path
:
string
)
{
const
native
=
!
mixSider
.
value
;
const
menuList
=
toRaw
(
menus
.
value
);
useTimeoutFn
(
()
=>
{
if
(
menuList
?.
length
===
0
)
{
menuState
.
activeSubMenuNames
=
[];
menuState
.
openNames
=
[];
return
;
}
const
keys
=
getAllParentPath
(
menuList
,
path
);
if
(
!
unref
(
accordion
))
{
menuState
.
openNames
=
uniq
([...
menuState
.
openNames
,
...
keys
]);
}
else
{
menuState
.
openNames
=
keys
;
}
menuState
.
activeSubMenuNames
=
menuState
.
openNames
;
},
30
,
native
,
);
const
handle
=
()
=>
{
if
(
menuList
?.
length
===
0
)
{
menuState
.
activeSubMenuNames
=
[];
menuState
.
openNames
=
[];
return
;
}
const
keys
=
getAllParentPath
(
menuList
,
path
);
if
(
!
unref
(
accordion
))
{
menuState
.
openNames
=
uniq
([...
menuState
.
openNames
,
...
keys
]);
}
else
{
menuState
.
openNames
=
keys
;
}
menuState
.
activeSubMenuNames
=
menuState
.
openNames
;
};
if
(
native
)
{
handle
();
}
else
{
useTimeoutFn
(
handle
,
30
);
}
}
const
getOpenKeys
=
computed
(()
=>
{
...
...
src/components/Table/src/hooks/useDataSource.ts
浏览文件 @
fa18365c
...
...
@@ -11,7 +11,7 @@ import {
Ref
,
watchEffect
,
}
from
'
vue
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
import
{
buildUUID
}
from
'
/@/utils/uuid
'
;
import
{
isFunction
,
isBoolean
,
isObject
}
from
'
/@/utils/is
'
;
import
{
get
,
cloneDeep
,
merge
}
from
'
lodash-es
'
;
...
...
src/components/Verify/src/DragVerify.vue
浏览文件 @
fa18365c
<
script
lang=
"tsx"
>
import
type
{
Ref
}
from
'
vue
'
;
import
{
defineComponent
,
ref
,
computed
,
unref
,
reactive
,
watch
,
watchEffect
}
from
'
vue
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
import
{
useEventListener
}
from
'
/@/hooks/event/useEventListener
'
;
import
{
basicProps
}
from
'
./props
'
;
import
{
getSlot
}
from
'
/@/utils/helper/tsxHelper
'
;
...
...
src/components/Verify/src/ImgRotate.vue
浏览文件 @
fa18365c
<
script
lang=
"tsx"
>
import
type
{
MoveData
,
DragVerifyActionType
}
from
'
./typing
'
;
import
{
defineComponent
,
computed
,
unref
,
reactive
,
watch
,
ref
}
from
'
vue
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
import
BasicDragVerify
from
'
./DragVerify.vue
'
;
import
{
hackCss
}
from
'
/@/utils/domUtils
'
;
import
{
rotateProps
}
from
'
./props
'
;
...
...
src/hooks/core/useTimeout.ts
已删除
100644 → 0
浏览文件 @
feadf64e
import
{
ref
,
watch
}
from
'
vue
'
;
import
{
tryOnUnmounted
}
from
'
@vueuse/core
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
export
function
useTimeoutFn
(
handle
:
Fn
<
any
>
,
wait
:
number
,
native
=
false
)
{
if
(
!
isFunction
(
handle
))
{
throw
new
Error
(
'
handle is not Function!
'
);
}
const
{
readyRef
,
stop
,
start
}
=
useTimeoutRef
(
wait
);
if
(
native
)
{
handle
();
}
else
{
watch
(
readyRef
,
(
maturity
)
=>
{
maturity
&&
handle
();
},
{
immediate
:
false
},
);
}
return
{
readyRef
,
stop
,
start
};
}
export
function
useTimeoutRef
(
wait
:
number
)
{
const
readyRef
=
ref
(
false
);
let
timer
:
TimeoutHandle
;
function
stop
():
void
{
readyRef
.
value
=
false
;
timer
&&
window
.
clearTimeout
(
timer
);
}
function
start
():
void
{
stop
();
timer
=
setTimeout
(()
=>
{
readyRef
.
value
=
true
;
},
wait
);
}
start
();
tryOnUnmounted
(
stop
);
return
{
readyRef
,
stop
,
start
};
}
src/hooks/web/useECharts.ts
浏览文件 @
fa18365c
import
type
{
EChartsOption
}
from
'
echarts
'
;
import
type
{
Ref
}
from
'
vue
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useTimeoutFn
}
from
'
@vben/hooks
'
;
import
{
tryOnUnmounted
,
useDebounceFn
}
from
'
@vueuse/core
'
;
import
{
unref
,
nextTick
,
watch
,
computed
,
ref
}
from
'
vue
'
;
import
{
useEventListener
}
from
'
/@/hooks/event/useEventListener
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录