Commit 8fd1994b5f92d99989fab4dfecf0ccb2d5f37876
1 parent
2f12556d
chore: bump 2.0.0-rc.3
Showing
4 changed files
with
61 additions
and
7 deletions
CHANGELOG.en_US.md
1 | +# 2.0.0-rc.3 (2020-10-19) | |
2 | + | |
3 | +### ✨ Features | |
4 | + | |
5 | +- Added excel component and excel/xml/csv/html export example | |
6 | +- Added excel import example | |
7 | +- Added global error handling | |
8 | +- Added markdown components and examples | |
9 | +- The menu name can be displayed when adding a new folding menu | |
10 | + | |
11 | +### Docs | |
12 | + | |
13 | +- add project doc | |
14 | + | |
15 | +### 🎫 Chores | |
16 | + | |
17 | +- update deps | |
18 | + | |
19 | +### 🐛 Bug Fixes | |
20 | + | |
21 | +- Fix the adaptive problem of the top menu | |
22 | +- Fix window system packaging error | |
23 | + | |
1 | 24 | # 2.0.0-rc.2 (2020-10-17) |
2 | 25 | |
3 | 26 | ### ✨ Features | ... | ... |
CHANGELOG.zh_CN.md
1 | +# 2.0.0-rc.3 (2020-10-19) | |
2 | + | |
3 | +### ✨ Features | |
4 | + | |
5 | +- 新增 excel 组件及 excel/xml/csv/html 导出示例 | |
6 | +- 新增 excel 导入示例 | |
7 | +- 新增全局错误处理 | |
8 | +- 新增 markdown 组件及示例 | |
9 | +- 新增折叠菜单时可显示菜单名 | |
10 | + | |
11 | +### Docs | |
12 | + | |
13 | +- 添加项目文档 | |
14 | + | |
15 | +### 🎫 Chores | |
16 | + | |
17 | +- 升级依赖 | |
18 | +- 其他细节优化 | |
19 | + | |
20 | +### 🐛 Bug Fixes | |
21 | + | |
22 | +- 修复顶部菜单自适应问题 | |
23 | +- 修复 window 系统打包报错问题 | |
24 | + | |
1 | 25 | # 2.0.0-rc.2 (2020-10-17) |
2 | 26 | |
3 | 27 | ### ✨ Features | ... | ... |
package.json
src/hooks/event/useWindowSize.ts
... | ... | @@ -4,7 +4,6 @@ import { tryOnMounted, tryOnUnmounted } from '/@/utils/helper/vueHelper'; |
4 | 4 | import { ref } from 'vue'; |
5 | 5 | |
6 | 6 | import { useDebounce } from '/@/hooks/core/useDebounce'; |
7 | -import { CancelFn } from '../core/types'; | |
8 | 7 | |
9 | 8 | interface WindowSizeOptions { |
10 | 9 | once?: boolean; |
... | ... | @@ -12,25 +11,33 @@ interface WindowSizeOptions { |
12 | 11 | listenerOptions?: AddEventListenerOptions | boolean; |
13 | 12 | } |
14 | 13 | |
15 | -export function useWindowSizeFn<T>(fn: Fn<T>, wait = 150, options?: WindowSizeOptions): CancelFn { | |
14 | +export function useWindowSizeFn<T>(fn: Fn<T>, wait = 150, options?: WindowSizeOptions) { | |
16 | 15 | let handler = () => { |
17 | 16 | fn(); |
18 | 17 | }; |
19 | 18 | const [handleSize, cancel] = useDebounce(handler, wait, options); |
20 | 19 | handler = handleSize; |
21 | 20 | |
22 | - tryOnMounted(() => { | |
21 | + const start = () => { | |
23 | 22 | if (options && options.immediate) { |
24 | 23 | handler(); |
25 | 24 | } |
26 | 25 | window.addEventListener('resize', handler); |
27 | - }); | |
26 | + }; | |
28 | 27 | |
29 | - tryOnUnmounted(() => { | |
28 | + const stop = () => { | |
30 | 29 | window.removeEventListener('resize', handler); |
31 | 30 | cancel(); |
31 | + }; | |
32 | + | |
33 | + tryOnMounted(() => { | |
34 | + start(); | |
35 | + }); | |
36 | + | |
37 | + tryOnUnmounted(() => { | |
38 | + stop(); | |
32 | 39 | }); |
33 | - return cancel; | |
40 | + return [start, stop]; | |
34 | 41 | } |
35 | 42 | |
36 | 43 | export const useWindowSize = (wait = 150, options?: WindowSizeOptions) => { | ... | ... |