Commit da76f3c77bd044caaf65e2c7a5c1c9dd72b4ca44

Authored by vben
1 parent 7a07b703

fix(layout): fix layout scale error

CHANGELOG.zh_CN.md
... ... @@ -10,6 +10,8 @@
10 10  
11 11 - 修复表格列配置已知问题
12 12 - 恢复 table 的`isTreeTable`属性
  13 +- 修复表格内存溢出问题
  14 +- 修复`layout` 收缩展开功能在分割模式下失效
13 15  
14 16 ## 2.0.0-rc.15 (2020-12-31)
15 17  
... ...
src/components/Basic/index.ts
1 1 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
2 2 import BasicArrow from './src/BasicArrow.vue';
  3 +import BasicTitle from './src/BasicTitle.vue';
3 4  
4   -export { BasicArrow };
  5 +export { BasicArrow, BasicTitle };
5 6  
6 7 // export const BasicArrow = createAsyncComponent(() => import('./src/BasicArrow.vue'));
7 8 export const BasicHelp = createAsyncComponent(() => import('./src/BasicHelp.vue'));
8   -export const BasicTitle = createAsyncComponent(() => import('./src/BasicTitle.vue'));
  9 +// export const BasicTitle = createAsyncComponent(() => import('./src/BasicTitle.vue'));
... ...
src/components/Description/index.ts
1   -import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
2   -export const Description = createAsyncComponent(() => import('./src/index'));
  1 +// import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  2 +// export const Description = createAsyncComponent(() => import('./src/index'));
3 3  
  4 +import Description from './src/index';
  5 +
  6 +export { Description };
4 7 export * from './src/types';
5 8 export { useDescription } from './src/useDescription';
... ...
src/components/Menu/index.ts
1 1 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
2 2  
3   -export const BasicMenu = createAsyncComponent(() => import('./src/BasicMenu.vue'));
  3 +import BasicMenu from './src/BasicMenu.vue';
  4 +
  5 +// export const BasicMenu = createAsyncComponent(() => import('./src/BasicMenu.vue'));
4 6  
5 7 export const MenuTag = createAsyncComponent(() => import('./src/components/MenuItemTag.vue'));
  8 +
  9 +export { BasicMenu };
... ...
src/components/Menu/src/useOpenKeys.ts
... ... @@ -23,7 +23,6 @@ export function useOpenKeys(
23 23 return;
24 24 }
25 25 const native = unref(getIsMixSidebar) && unref(getMixSideFixed);
26   -
27 26 useTimeoutFn(
28 27 () => {
29 28 const menuList = toRaw(menus.value);
... ... @@ -37,7 +36,7 @@ export function useOpenKeys(
37 36 }
38 37 },
39 38 16,
40   - native
  39 + !native
41 40 );
42 41 }
43 42  
... ...
src/components/Table/src/components/editable/EditableCell.vue
... ... @@ -148,10 +148,16 @@
148 148 });
149 149  
150 150 watchEffect(() => {
  151 + console.log('======================');
  152 + console.log(1);
  153 + console.log('======================');
151 154 defaultValueRef.value = props.value;
152 155 });
153 156  
154 157 watchEffect(() => {
  158 + console.log('======================');
  159 + console.log(2);
  160 + console.log('======================');
155 161 const { editable } = props.column;
156 162 if (isBoolean(editable) || isBoolean(unref(getRowEditable))) {
157 163 isEdit.value = !!editable || unref(getRowEditable);
... ...
src/components/Table/src/hooks/useDataSource.ts
1 1 import type { BasicTableProps, FetchParams, SorterResult } from '../types/table';
2 2 import type { PaginationProps } from '../types/pagination';
3 3  
4   -import { ref, unref, ComputedRef, computed, onMounted, watchEffect, reactive } from 'vue';
  4 +import { ref, unref, ComputedRef, computed, onMounted, watch, reactive } from 'vue';
5 5  
6 6 import { useTimeoutFn } from '/@/hooks/core/useTimeout';
7 7  
... ... @@ -40,10 +40,21 @@ export function useDataSource(
40 40 });
41 41 const dataSourceRef = ref<Recordable[]>([]);
42 42  
43   - watchEffect(() => {
44   - const { dataSource, api } = unref(propsRef);
45   - !api && dataSource && (dataSourceRef.value = dataSource);
46   - });
  43 + // watchEffect(() => {
  44 + // const { dataSource, api } = unref(propsRef);
  45 + // !api && dataSource && (dataSourceRef.value = dataSource);
  46 + // });
  47 +
  48 + watch(
  49 + () => unref(propsRef).dataSource,
  50 + () => {
  51 + const { dataSource, api } = unref(propsRef);
  52 + !api && dataSource && (dataSourceRef.value = dataSource);
  53 + },
  54 + {
  55 + immediate: true,
  56 + }
  57 + );
47 58  
48 59 function handleTableChange(
49 60 pagination: PaginationProps,
... ...
src/components/Table/src/hooks/useLoading.ts
1   -import { ref, ComputedRef, unref, computed, watchEffect } from 'vue';
  1 +import { ref, ComputedRef, unref, computed, watch } from 'vue';
2 2 import type { BasicTableProps } from '../types/table';
3 3  
4 4 export function useLoading(props: ComputedRef<BasicTableProps>) {
5 5 const loadingRef = ref(unref(props).loading);
6 6  
7   - watchEffect(() => {
8   - loadingRef.value = unref(props).loading;
9   - });
  7 + watch(
  8 + () => unref(props).loading,
  9 + (loading) => {
  10 + loadingRef.value = loading;
  11 + }
  12 + );
10 13  
11 14 const getLoading = computed(() => {
12 15 return unref(loadingRef);
... ...
src/components/Table/src/hooks/useTableScroll.ts
1 1 import type { BasicTableProps, TableRowSelection } from '../types/table';
2 2 import type { Ref, ComputedRef } from 'vue';
3   -import { computed, unref, ref, nextTick, watchEffect } from 'vue';
  3 +import { computed, unref, ref, nextTick, watch } from 'vue';
4 4  
5 5 import { getViewportOffset } from '/@/utils/domUtils';
6 6 import { isBoolean } from '/@/utils/is';
... ... @@ -28,9 +28,15 @@ export function useTableScroll(
28 28 return canResize && !(scroll || {}).y;
29 29 });
30 30  
31   - watchEffect(() => {
32   - unref(getCanResize) && debounceRedoHeight();
33   - });
  31 + watch(
  32 + () => unref(getCanResize),
  33 + () => {
  34 + debounceRedoHeight();
  35 + },
  36 + {
  37 + immediate: true,
  38 + }
  39 + );
34 40  
35 41 function redoHeight() {
36 42 if (unref(getCanResize)) {
... ...
src/layouts/default/header/MultipleHeader.vue
... ... @@ -34,6 +34,7 @@
34 34 getShowInsetHeaderRef,
35 35 getShowFullHeaderRef,
36 36 getHeaderTheme,
  37 + getShowHeader,
37 38 } = useHeaderSetting();
38 39  
39 40 const { getFullContent } = useFullContent();
... ... @@ -68,7 +69,7 @@
68 69 const getPlaceholderDomStyle = computed(
69 70 (): CSSProperties => {
70 71 let height = 0;
71   - if (unref(getShowFullHeaderRef) || !unref(getSplit)) {
  72 + if ((unref(getShowFullHeaderRef) || !unref(getSplit)) && unref(getShowHeader)) {
72 73 height += HEADER_HEIGHT;
73 74 }
74 75 if (unref(getShowMultipleTab)) {
... ...
src/layouts/default/tabs/useTabDropdown.ts
... ... @@ -129,6 +129,7 @@ export function useTabDropdown(tabContentProps: TabContentProps) {
129 129 const isScale = !unref(getShowMenu) && !unref(getShowHeader);
130 130 setMenuSetting({
131 131 show: isScale,
  132 + hidden: !isScale,
132 133 });
133 134 setHeaderSetting({
134 135 show: isScale,
... ...