Skip to content

Commit be3a3ed

Browse files
committed
perf: remove useless code
1 parent 562189d commit be3a3ed

File tree

23 files changed

+46
-521
lines changed

23 files changed

+46
-521
lines changed

.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ VITE_PUBLIC_PATH = /
77
# Delete console
88
VITE_DROP_CONSOLE = true
99

10-
# Whether to enable gizp or brotli compression
10+
# Whether to enable gzip or brotli compression
1111
# Optional: gzip | brotli | none
1212
# If you need multiple forms, you can use `,` to separate
1313
VITE_BUILD_COMPRESS = 'none'

src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
setup() {
2323
// support Multi-language
2424
const { antConfigLocale, setLocale } = useLocale();
25+
2526
setLocale();
2627
2728
// Initialize vuex internal system configuration
2829
initAppConfigStore();
30+
2931
// Create a lock screen monitor
3032
const lockEvent = useLockPage();
3133

src/components/Form/src/hooks/useFormEvents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import type { NamePath } from 'ant-design-vue/lib/form/interface';
55
import { unref, toRaw } from 'vue';
66

77
import { isArray, isFunction, isObject, isString } from '/@/utils/is';
8-
import { deepMerge, unique } from '/@/utils';
8+
import { deepMerge } from '/@/utils';
99
import { dateItemType, handleInputNumberValue } from '../helper';
1010
import { dateUtil } from '/@/utils/dateUtil';
11-
import { cloneDeep } from 'lodash-es';
11+
import { cloneDeep, uniqBy } from 'lodash-es';
1212
import { error } from '/@/utils/log';
1313

1414
interface UseFormActionContext {
@@ -160,7 +160,7 @@ export function useFormEvents({
160160
}
161161
});
162162
});
163-
schemaRef.value = unique(schema, 'field');
163+
schemaRef.value = uniqBy(schema, 'field');
164164
}
165165

166166
function getFieldsValue(): Recordable {

src/components/Menu/src/useOpenKeys.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { MenuState } from './types';
55
import { computed, Ref, toRaw } from 'vue';
66

77
import { unref } from 'vue';
8-
import { es6Unique } from '/@/utils';
8+
import { uniq } from 'lodash-es';
99
import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
1010
import { getAllParentPath } from '/@/router/helper/menuHelper';
1111
import { useTimeoutFn } from '/@/hooks/core/useTimeout';
@@ -31,10 +31,7 @@ export function useOpenKeys(
3131
return;
3232
}
3333
if (!unref(accordion)) {
34-
menuState.openKeys = es6Unique([
35-
...menuState.openKeys,
36-
...getAllParentPath(menuList, path),
37-
]);
34+
menuState.openKeys = uniq([...menuState.openKeys, ...getAllParentPath(menuList, path)]);
3835
} else {
3936
menuState.openKeys = getAllParentPath(menuList, path);
4037
}

src/components/SimpleMenu/src/useOpenKeys.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import type { MenuState } from './types';
44
import { computed, Ref, toRaw } from 'vue';
55

66
import { unref } from 'vue';
7-
import { es6Unique } from '/@/utils';
7+
import { uniq } from 'lodash-es';
88
import { getAllParentPath } from '/@/router/helper/menuHelper';
9+
910
import { useTimeoutFn } from '/@/hooks/core/useTimeout';
1011

1112
export function useOpenKeys(
@@ -31,7 +32,7 @@ export function useOpenKeys(
3132
}
3233
const keys = getAllParentPath(menuList, path);
3334
if (!unref(accordion)) {
34-
menuState.openNames = es6Unique([...menuState.openNames, ...keys]);
35+
menuState.openNames = uniq([...menuState.openNames, ...keys]);
3536
} else {
3637
menuState.openNames = keys;
3738
}

src/components/VirtualScroll/src/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,22 @@ import {
1111
} from 'vue';
1212
import { useEventListener } from '/@/hooks/event/useEventListener';
1313

14-
import { convertToUnit } from '/@/components/util';
1514
import { props as basicProps } from './props';
1615
import { getSlot } from '/@/utils/helper/tsxHelper';
1716
import './index.less';
1817

1918
const prefixCls = 'virtual-scroll';
19+
20+
function convertToUnit(str: string | number | null | undefined, unit = 'px'): string | undefined {
21+
if (str == null || str === '') {
22+
return undefined;
23+
} else if (isNaN(+str!)) {
24+
return String(str);
25+
} else {
26+
return `${Number(str)}${unit}`;
27+
}
28+
}
29+
2030
export default defineComponent({
2131
name: 'VirtualScroll',
2232
props: basicProps,

src/components/registerGlobComp.ts

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,6 @@ import { Button } from './Button';
33
import {
44
// Need
55
Button as AntButton,
6-
7-
// Optional
8-
// Select,
9-
// Alert,
10-
// Checkbox,
11-
// DatePicker,
12-
// Radio,
13-
// Switch,
14-
// Card,
15-
// List,
16-
// Tabs,
17-
// Descriptions,
18-
// Tree,
19-
// Table,
20-
// Divider,
21-
// Modal,
22-
// Drawer,
23-
// Dropdown,
24-
// Tag,
25-
// Tooltip,
26-
// Badge,
27-
// Popover,
28-
// Upload,
29-
// Transfer,
30-
// Steps,
31-
// PageHeader,
32-
// Result,
33-
// Empty,
34-
// Avatar,
35-
// Menu,
36-
// Breadcrumb,
37-
// Form,
38-
// Input,
39-
// Row,
40-
// Col,
41-
// Spin,
426
} from 'ant-design-vue';
437

448
import { App } from 'vue';
@@ -47,45 +11,6 @@ const compList = [Icon, Button, AntButton.Group];
4711

4812
export function registerGlobComp(app: App) {
4913
compList.forEach((comp: any) => {
50-
app.component(comp.name, comp);
14+
app.component(comp.name || comp.displayName, comp);
5115
});
52-
53-
// Optional
54-
// If you need to customize global components, you can write here
55-
// If you don’t need it, you can delete it
56-
// app
57-
// .use(Select)
58-
// .use(Alert)
59-
// .use(Breadcrumb)
60-
// .use(Checkbox)
61-
// .use(DatePicker)
62-
// .use(Radio)
63-
// .use(Switch)
64-
// .use(Card)
65-
// .use(List)
66-
// .use(Descriptions)
67-
// .use(Tree)
68-
// .use(Table)
69-
// .use(Divider)
70-
// .use(Modal)
71-
// .use(Drawer)
72-
// .use(Dropdown)
73-
// .use(Tag)
74-
// .use(Tooltip)
75-
// .use(Badge)
76-
// .use(Popover)
77-
// .use(Upload)
78-
// .use(Transfer)
79-
// .use(Steps)
80-
// .use(PageHeader)
81-
// .use(Result)
82-
// .use(Empty)
83-
// .use(Avatar)
84-
// .use(Menu)
85-
// .use(Tabs)
86-
// .use(Form)
87-
// .use(Input)
88-
// .use(Row)
89-
// .use(Col)
90-
// .use(Spin);
9116
}

src/components/types.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/components/util.tsx

Lines changed: 0 additions & 176 deletions
This file was deleted.

0 commit comments

Comments
 (0)