Skip to content

Commit

Permalink
perf: remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Feb 21, 2021
1 parent 562189d commit be3a3ed
Show file tree
Hide file tree
Showing 23 changed files with 46 additions and 521 deletions.
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VITE_PUBLIC_PATH = /
# Delete console
VITE_DROP_CONSOLE = true

# Whether to enable gizp or brotli compression
# Whether to enable gzip or brotli compression
# Optional: gzip | brotli | none
# If you need multiple forms, you can use `,` to separate
VITE_BUILD_COMPRESS = 'none'
Expand Down
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
setup() {
// support Multi-language
const { antConfigLocale, setLocale } = useLocale();
setLocale();
// Initialize vuex internal system configuration
initAppConfigStore();
// Create a lock screen monitor
const lockEvent = useLockPage();
Expand Down
6 changes: 3 additions & 3 deletions src/components/Form/src/hooks/useFormEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import type { NamePath } from 'ant-design-vue/lib/form/interface';
import { unref, toRaw } from 'vue';

import { isArray, isFunction, isObject, isString } from '/@/utils/is';
import { deepMerge, unique } from '/@/utils';
import { deepMerge } from '/@/utils';
import { dateItemType, handleInputNumberValue } from '../helper';
import { dateUtil } from '/@/utils/dateUtil';
import { cloneDeep } from 'lodash-es';
import { cloneDeep, uniqBy } from 'lodash-es';
import { error } from '/@/utils/log';

interface UseFormActionContext {
Expand Down Expand Up @@ -160,7 +160,7 @@ export function useFormEvents({
}
});
});
schemaRef.value = unique(schema, 'field');
schemaRef.value = uniqBy(schema, 'field');
}

function getFieldsValue(): Recordable {
Expand Down
7 changes: 2 additions & 5 deletions src/components/Menu/src/useOpenKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { MenuState } from './types';
import { computed, Ref, toRaw } from 'vue';

import { unref } from 'vue';
import { es6Unique } from '/@/utils';
import { uniq } from 'lodash-es';
import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
import { getAllParentPath } from '/@/router/helper/menuHelper';
import { useTimeoutFn } from '/@/hooks/core/useTimeout';
Expand All @@ -31,10 +31,7 @@ export function useOpenKeys(
return;
}
if (!unref(accordion)) {
menuState.openKeys = es6Unique([
...menuState.openKeys,
...getAllParentPath(menuList, path),
]);
menuState.openKeys = uniq([...menuState.openKeys, ...getAllParentPath(menuList, path)]);
} else {
menuState.openKeys = getAllParentPath(menuList, path);
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/SimpleMenu/src/useOpenKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import type { MenuState } from './types';
import { computed, Ref, toRaw } from 'vue';

import { unref } from 'vue';
import { es6Unique } from '/@/utils';
import { uniq } from 'lodash-es';
import { getAllParentPath } from '/@/router/helper/menuHelper';

import { useTimeoutFn } from '/@/hooks/core/useTimeout';

export function useOpenKeys(
Expand All @@ -31,7 +32,7 @@ export function useOpenKeys(
}
const keys = getAllParentPath(menuList, path);
if (!unref(accordion)) {
menuState.openNames = es6Unique([...menuState.openNames, ...keys]);
menuState.openNames = uniq([...menuState.openNames, ...keys]);
} else {
menuState.openNames = keys;
}
Expand Down
12 changes: 11 additions & 1 deletion src/components/VirtualScroll/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ import {
} from 'vue';
import { useEventListener } from '/@/hooks/event/useEventListener';

import { convertToUnit } from '/@/components/util';
import { props as basicProps } from './props';
import { getSlot } from '/@/utils/helper/tsxHelper';
import './index.less';

const prefixCls = 'virtual-scroll';

function convertToUnit(str: string | number | null | undefined, unit = 'px'): string | undefined {
if (str == null || str === '') {
return undefined;
} else if (isNaN(+str!)) {
return String(str);
} else {
return `${Number(str)}${unit}`;
}
}

export default defineComponent({
name: 'VirtualScroll',
props: basicProps,
Expand Down
77 changes: 1 addition & 76 deletions src/components/registerGlobComp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,6 @@ import { Button } from './Button';
import {
// Need
Button as AntButton,

// Optional
// Select,
// Alert,
// Checkbox,
// DatePicker,
// Radio,
// Switch,
// Card,
// List,
// Tabs,
// Descriptions,
// Tree,
// Table,
// Divider,
// Modal,
// Drawer,
// Dropdown,
// Tag,
// Tooltip,
// Badge,
// Popover,
// Upload,
// Transfer,
// Steps,
// PageHeader,
// Result,
// Empty,
// Avatar,
// Menu,
// Breadcrumb,
// Form,
// Input,
// Row,
// Col,
// Spin,
} from 'ant-design-vue';

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

export function registerGlobComp(app: App) {
compList.forEach((comp: any) => {
app.component(comp.name, comp);
app.component(comp.name || comp.displayName, comp);
});

// Optional
// If you need to customize global components, you can write here
// If you don’t need it, you can delete it
// app
// .use(Select)
// .use(Alert)
// .use(Breadcrumb)
// .use(Checkbox)
// .use(DatePicker)
// .use(Radio)
// .use(Switch)
// .use(Card)
// .use(List)
// .use(Descriptions)
// .use(Tree)
// .use(Table)
// .use(Divider)
// .use(Modal)
// .use(Drawer)
// .use(Dropdown)
// .use(Tag)
// .use(Tooltip)
// .use(Badge)
// .use(Popover)
// .use(Upload)
// .use(Transfer)
// .use(Steps)
// .use(PageHeader)
// .use(Result)
// .use(Empty)
// .use(Avatar)
// .use(Menu)
// .use(Tabs)
// .use(Form)
// .use(Input)
// .use(Row)
// .use(Col)
// .use(Spin);
}
6 changes: 0 additions & 6 deletions src/components/types.ts

This file was deleted.

176 changes: 0 additions & 176 deletions src/components/util.tsx

This file was deleted.

Loading

0 comments on commit be3a3ed

Please sign in to comment.