Commit 8fd1994b5f92d99989fab4dfecf0ccb2d5f37876

Authored by vben
1 parent 2f12556d

chore: bump 2.0.0-rc.3

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 # 2.0.0-rc.2 (2020-10-17) 24 # 2.0.0-rc.2 (2020-10-17)
2 25
3 ### ✨ Features 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 # 2.0.0-rc.2 (2020-10-17) 25 # 2.0.0-rc.2 (2020-10-17)
2 26
3 ### ✨ Features 27 ### ✨ Features
package.json
1 { 1 {
2 "name": "vben-admin-2.0", 2 "name": "vben-admin-2.0",
3 - "version": "2.0.0-rc.2", 3 + "version": "2.0.0-rc.3",
4 "scripts": { 4 "scripts": {
5 "bootstrap": "yarn install", 5 "bootstrap": "yarn install",
6 "serve": "cross-env ts-node --files -P ./build/tsconfig.json ./build/script/preserve && cross-env NODE_ENV=development vite", 6 "serve": "cross-env ts-node --files -P ./build/tsconfig.json ./build/script/preserve && cross-env NODE_ENV=development vite",
src/hooks/event/useWindowSize.ts
@@ -4,7 +4,6 @@ import { tryOnMounted, tryOnUnmounted } from '/@/utils/helper/vueHelper'; @@ -4,7 +4,6 @@ import { tryOnMounted, tryOnUnmounted } from '/@/utils/helper/vueHelper';
4 import { ref } from 'vue'; 4 import { ref } from 'vue';
5 5
6 import { useDebounce } from '/@/hooks/core/useDebounce'; 6 import { useDebounce } from '/@/hooks/core/useDebounce';
7 -import { CancelFn } from '../core/types';  
8 7
9 interface WindowSizeOptions { 8 interface WindowSizeOptions {
10 once?: boolean; 9 once?: boolean;
@@ -12,25 +11,33 @@ interface WindowSizeOptions { @@ -12,25 +11,33 @@ interface WindowSizeOptions {
12 listenerOptions?: AddEventListenerOptions | boolean; 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 let handler = () => { 15 let handler = () => {
17 fn(); 16 fn();
18 }; 17 };
19 const [handleSize, cancel] = useDebounce(handler, wait, options); 18 const [handleSize, cancel] = useDebounce(handler, wait, options);
20 handler = handleSize; 19 handler = handleSize;
21 20
22 - tryOnMounted(() => { 21 + const start = () => {
23 if (options && options.immediate) { 22 if (options && options.immediate) {
24 handler(); 23 handler();
25 } 24 }
26 window.addEventListener('resize', handler); 25 window.addEventListener('resize', handler);
27 - }); 26 + };
28 27
29 - tryOnUnmounted(() => { 28 + const stop = () => {
30 window.removeEventListener('resize', handler); 29 window.removeEventListener('resize', handler);
31 cancel(); 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 export const useWindowSize = (wait = 150, options?: WindowSizeOptions) => { 43 export const useWindowSize = (wait = 150, options?: WindowSizeOptions) => {