Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zuiqiangwanggong
vue-vben-admin
提交
35d2bfc5
V
vue-vben-admin
项目概览
zuiqiangwanggong
/
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,发现更多精彩内容 >>
提交
35d2bfc5
编写于
11月 01, 2020
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix message type error
上级
f645680a
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
78 addition
and
16 deletion
+78
-16
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+1
-0
src/components/Container/src/collapse/CollapseHeader.vue
src/components/Container/src/collapse/CollapseHeader.vue
+2
-9
src/hooks/core/asyncComputed.ts
src/hooks/core/asyncComputed.ts
+56
-0
src/hooks/core/types.ts
src/hooks/core/types.ts
+2
-2
src/hooks/web/useMessage.tsx
src/hooks/web/useMessage.tsx
+13
-5
src/utils/index.ts
src/utils/index.ts
+4
-0
未找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
35d2bfc5
...
...
@@ -23,6 +23,7 @@
-
修复表格开启搜索表单折叠问题
-
修复表格 size 为 samll 时候,fixed 列样式问题
-
修复多标签页关闭报错问题
-
修复 message 类型错误
## 2.0.0-rc.7 (2020-10-31)
...
...
src/components/Container/src/collapse/CollapseHeader.vue
浏览文件 @
35d2bfc5
...
...
@@ -11,22 +11,15 @@
<div
class=
"collapse-container__action"
>
<slot
name=
"action"
/>
<BasicArrow
v-if=
"$attrs.canExpan"
:expand=
"$attrs.show"
@
click=
"
handleExpand
"
/>
<BasicArrow
v-if=
"$attrs.canExpan"
:expand=
"$attrs.show"
@
click=
"
$emit('expand')
"
/>
</div>
</div>
</template>
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
'
vue
'
;
import
{
BasicArrow
}
from
'
/@/components/Basic
'
;
import
{
BasicTitle
}
from
'
/@/components/Basic
'
;
import
{
BasicArrow
,
BasicTitle
}
from
'
/@/components/Basic
'
;
export
default
defineComponent
({
inheritAttrs
:
false
,
components
:
{
BasicArrow
,
BasicTitle
},
setup
(
_
,
{
emit
})
{
function
handleExpand
()
{
emit
(
'
expand
'
);
}
return
{
handleExpand
};
},
});
</
script
>
src/hooks/core/asyncComputed.ts
0 → 100644
浏览文件 @
35d2bfc5
import
{
ref
,
watchEffect
,
Ref
}
from
'
vue
'
;
/**
* Handle overlapping async evaluations
*
* @param cancelCallback The provided callback is invoked when a re-evaluation of the computed value is triggered before the previous one finished
*/
export
type
AsyncComputedOnCancel
=
(
cancelCallback
:
()
=>
void
)
=>
void
;
/**
* A two-item tuple with the first item being a ref to the computed value and the second item holding a boolean ref, indicating whether the async computed value is currently (re-)evaluated
*/
export
type
AsyncComputedResult
<
T
>
=
[
Ref
<
T
>
,
Ref
<
boolean
>
];
/**
* Create an asynchronous computed dependency
*
* @param evaluationCallback The promise-returning callback which generates the computed value
* @param defaultValue A default value, used until the first evaluation finishes
*/
export
function
asyncComputed
<
T
>
(
evaluationCallback
:
(
onCancel
:
AsyncComputedOnCancel
)
=>
T
|
Promise
<
T
>
,
defaultValue
?:
T
):
AsyncComputedResult
<
T
>
{
let
counter
=
0
;
const
current
=
ref
(
defaultValue
)
as
Ref
<
T
>
;
const
evaluating
=
ref
<
boolean
>
(
false
);
watchEffect
(
async
(
onInvalidate
:
Fn
)
=>
{
counter
++
;
const
counterAtBeginning
=
counter
;
let
hasFinished
=
false
;
try
{
// Defer initial setting of `evaluating` ref
// to avoid having it as a dependency
Promise
.
resolve
().
then
(()
=>
{
evaluating
.
value
=
true
;
});
const
result
=
await
evaluationCallback
((
cancelCallback
)
=>
{
onInvalidate
(()
=>
{
evaluating
.
value
=
false
;
if
(
!
hasFinished
)
cancelCallback
();
});
});
if
(
counterAtBeginning
===
counter
)
current
.
value
=
result
;
}
finally
{
evaluating
.
value
=
false
;
hasFinished
=
true
;
}
});
return
[
current
,
evaluating
];
}
src/hooks/core/types.ts
浏览文件 @
35d2bfc5
import
type
{
VNode
,
Ref
}
from
'
vue
'
;
import
type
{
Modal
Options
}
from
'
ant-design-vue/types/modal
'
;
import
type
{
Modal
FuncProps
}
from
'
ant-design-vue/lib/modal/index
'
;
export
type
Fn
<
T
>
=
()
=>
T
;
export
type
AnyFn
<
T
>
=
(...
arg
:
any
)
=>
T
;
...
...
@@ -86,7 +86,7 @@ export interface MessageOptions {
/** Set the distance to the top of viewport. Default is 20 px. */
offset
?:
number
;
}
export
interface
ModalOptionsEx
extends
Omit
<
Modal
Option
s
,
'
iconType
'
>
{
export
interface
ModalOptionsEx
extends
Omit
<
Modal
FuncProp
s
,
'
iconType
'
>
{
iconType
:
'
warning
'
|
'
success
'
|
'
error
'
|
'
info
'
;
}
export
type
ModalOptionsPartial
=
Partial
<
ModalOptionsEx
>
&
Pick
<
ModalOptionsEx
,
'
content
'
>
;
src/hooks/web/useMessage.tsx
浏览文件 @
35d2bfc5
import
type
{
ModalOptionsEx
,
ModalOptionsPartial
}
from
'
/@/hooks/core/types
'
;
import
type
{
ModalFunc
,
ModalFuncProps
}
from
'
ant-design-vue/lib/modal/Modal
'
;
import
{
Modal
,
message
as
Message
,
notification
}
from
'
ant-design-vue
'
;
import
{
InfoCircleFilled
,
CheckCircleFilled
,
CloseCircleFilled
}
from
'
@ant-design/icons-vue
'
;
import
{
ModalOptions
,
ModalConfirm
}
from
'
ant-design-vue/types/modal
'
;
import
{
useSetting
}
from
'
/@/hooks/core/useSetting
'
;
interface
ConfirmOptions
{
info
:
ModalFunc
;
success
:
ModalFunc
;
error
:
ModalFunc
;
warn
:
ModalFunc
;
warning
:
ModalFunc
;
}
const
{
projectSetting
}
=
useSetting
();
function
getIcon
(
iconType
:
string
)
{
...
...
@@ -20,22 +28,22 @@ function getIcon(iconType: string) {
}
}
function
renderContent
({
content
}:
Pick
<
ModalOptionsEx
,
'
content
'
>
)
{
return
<
div
innerHTML
=
{
`<div>
${
content
}
</div>`
}
></
div
>;
return
<
div
innerHTML
=
{
`<div>
${
content
as
string
}
</div>`
}
></
div
>;
}
/**
* @description: Create confirmation box
*/
function
createConfirm
(
options
:
ModalOptionsEx
):
ModalConfirm
{
function
createConfirm
(
options
:
ModalOptionsEx
):
ConfirmOptions
{
const
iconType
=
options
.
iconType
||
'
warning
'
;
Reflect
.
deleteProperty
(
options
,
'
iconType
'
);
const
opt
:
Modal
Option
s
=
{
const
opt
:
Modal
FuncProp
s
=
{
centered
:
true
,
icon
:
getIcon
(
iconType
),
...
projectSetting
.
messageSetting
,
...
options
,
};
return
Modal
.
confirm
(
opt
);
return
Modal
.
confirm
(
opt
)
as
any
;
}
const
baseOptions
=
{
okText
:
'
确定
'
,
...
...
src/utils/index.ts
浏览文件 @
35d2bfc5
export
const
timestamp
=
()
=>
+
Date
.
now
();
export
const
clamp
=
(
n
:
number
,
min
:
number
,
max
:
number
)
=>
Math
.
min
(
max
,
Math
.
max
(
min
,
n
));
export
const
noop
=
()
=>
{};
export
const
now
=
()
=>
Date
.
now
();
/**
* @description: Set ui mount node
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录