Skip to content

Commit 26d9476

Browse files
committedJul 30, 2021
feat(use-loading): add setTip method
为useLoading添加setTip方法
1 parent ddd1893 commit 26d9476

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed
 

‎CHANGELOG.zh_CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- **Preview** 添加新的属性及事件
44
- **Dark Theme** 新增对 tailwindcss 夜间模式的支持
5+
- **其它** 为 useLoading 添加 setTip 方法
56

67
### 🐛 Bug Fixes
78

‎src/components/Loading/src/useLoading.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ interface Fn {
1212
(): void;
1313
}
1414

15-
export function useLoading(props: Partial<LoadingProps>): [Fn, Fn];
16-
export function useLoading(opt: Partial<UseLoadingOptions>): [Fn, Fn];
15+
export function useLoading(props: Partial<LoadingProps>): [Fn, Fn, (string) => void];
16+
export function useLoading(opt: Partial<UseLoadingOptions>): [Fn, Fn, (string) => void];
1717

18-
export function useLoading(opt: Partial<LoadingProps> | Partial<UseLoadingOptions>): [Fn, Fn] {
18+
export function useLoading(
19+
opt: Partial<LoadingProps> | Partial<UseLoadingOptions>
20+
): [Fn, Fn, (string) => void] {
1921
let props: Partial<LoadingProps>;
2022
let target: HTMLElement | Ref<ElRef> = document.body;
2123

@@ -39,5 +41,9 @@ export function useLoading(opt: Partial<LoadingProps> | Partial<UseLoadingOption
3941
instance.close();
4042
};
4143

42-
return [open, close];
44+
const setTip = (tip: string) => {
45+
instance.setTip(tip);
46+
};
47+
48+
return [open, close, setTip];
4349
}

0 commit comments

Comments
 (0)