Commit 6b3195b4ca88a33044bcd014e8c5d090710e7fbb

Authored by vben
1 parent 0434030f

fix(comp): fix the memory overflow problem of component containing keywords

CHANGELOG.zh_CN.md
@@ -4,6 +4,10 @@ @@ -4,6 +4,10 @@
4 4
5 - 移除左侧菜单搜索,新增顶部菜单搜索功能 5 - 移除左侧菜单搜索,新增顶部菜单搜索功能
6 6
  7 +### ⚡ Performance Improvements
  8 +
  9 +- 异步引入组件
  10 +
7 ### 🎫 Chores 11 ### 🎫 Chores
8 12
9 - 返回顶部样式调整,避免遮住其他元素 13 - 返回顶部样式调整,避免遮住其他元素
@@ -14,6 +18,9 @@ @@ -14,6 +18,9 @@
14 - 修复多级路由缓存导致组件渲染多次的问题 18 - 修复多级路由缓存导致组件渲染多次的问题
15 - 修复地图图表切换后消失问题 19 - 修复地图图表切换后消失问题
16 - 修复登录成功 notify 消失问题 20 - 修复登录成功 notify 消失问题
  21 +- 修改 `VirtualScroll`和`ImportExcel`组件名为`VScroll`与`ImpExcel`,暂时解决含有关键字的组件在 vue 模版内使用内存溢出
  22 +- 修复 axios 大小写问题
  23 +- 修复按钮样式问题
17 24
18 ## 2.0.0-rc.13 (2020-12-10) 25 ## 2.0.0-rc.13 (2020-12-10)
19 26
src/components/Application/index.ts
1 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
2 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; 2 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
3 3
4 -export const AppLocalePicker = createAsyncComponent(() => import('./src/AppLocalePicker.vue')); 4 +export const AppLocalePicker = createAsyncComponent(() => import('./src/AppLocalePicker.vue'), {
  5 + loading: true,
  6 +});
5 export const AppProvider = createAsyncComponent(() => import('./src/AppProvider.vue')); 7 export const AppProvider = createAsyncComponent(() => import('./src/AppProvider.vue'));
6 -export const AppSearch = createAsyncComponent(() => import('./src/search/AppSearch.vue')); 8 +export const AppSearch = createAsyncComponent(() => import('./src/search/AppSearch.vue'), {
  9 + loading: true,
  10 +});
7 export const AppLogo = createAsyncComponent(() => import('./src/AppLogo.vue')); 11 export const AppLogo = createAsyncComponent(() => import('./src/AppLogo.vue'));
8 12
9 withInstall(AppLocalePicker, AppLogo, AppProvider, AppSearch); 13 withInstall(AppLocalePicker, AppLogo, AppProvider, AppSearch);
src/components/Button/src/BasicButton.vue
1 <template> 1 <template>
2 <Button v-bind="getBindValue" :class="[getColor, $attrs.class]"> 2 <Button v-bind="getBindValue" :class="[getColor, $attrs.class]">
3 <template #default="data"> 3 <template #default="data">
4 - <Icon :icon="preIcon" :class="{ 'mr-1': !getIsCircleBtn }" v-if="preIcon" /> 4 + <Icon :icon="preIcon" v-if="preIcon" :size="14" />
5 <slot v-bind="data" /> 5 <slot v-bind="data" />
6 - <Icon :icon="postIcon" :class="{ 'ml-1': !getIsCircleBtn }" v-if="postIcon" /> 6 + <Icon :icon="postIcon" v-if="postIcon" :size="14" />
7 </template> 7 </template>
8 </Button> 8 </Button>
9 </template> 9 </template>
@@ -27,8 +27,6 @@ @@ -27,8 +27,6 @@
27 postIcon: propTypes.string, 27 postIcon: propTypes.string,
28 }, 28 },
29 setup(props, { attrs }) { 29 setup(props, { attrs }) {
30 - const getIsCircleBtn = computed(() => attrs.shape === 'circle');  
31 -  
32 const getColor = computed(() => { 30 const getColor = computed(() => {
33 const { color, disabled } = props; 31 const { color, disabled } = props;
34 return { 32 return {
@@ -41,7 +39,7 @@ @@ -41,7 +39,7 @@
41 return { ...attrs, ...props }; 39 return { ...attrs, ...props };
42 }); 40 });
43 41
44 - return { getBindValue, getColor, getIsCircleBtn }; 42 + return { getBindValue, getColor };
45 }, 43 },
46 }); 44 });
47 </script> 45 </script>
src/components/Container/index.ts
1 -import ScrollContainer from './src/ScrollContainer.vue';  
2 -import CollapseContainer from './src/collapse/CollapseContainer.vue';  
3 -import LazyContainer from './src/LazyContainer.vue';  
4 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
5 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const ScrollContainer = createAsyncComponent(() => import('./src/ScrollContainer.vue'));
  5 +export const CollapseContainer = createAsyncComponent(
  6 + () => import('./src/collapse/CollapseContainer.vue')
  7 +);
  8 +export const LazyContainer = createAsyncComponent(() => import('./src/LazyContainer.vue'));
  9 +
6 withInstall(ScrollContainer, CollapseContainer, LazyContainer); 10 withInstall(ScrollContainer, CollapseContainer, LazyContainer);
7 11
8 export * from './src/types'; 12 export * from './src/types';
9 -  
10 -export { ScrollContainer, CollapseContainer, LazyContainer };  
src/components/CountTo/index.ts
1 // Transform vue-count-to to support vue3 version 1 // Transform vue-count-to to support vue3 version
2 2
3 -import CountTo from './src/index.vue';  
4 import { withInstall } from '../util'; 3 import { withInstall } from '../util';
5 4
  5 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  6 +export const CountTo = createAsyncComponent(() => import('./src/index.vue'));
  7 +
6 withInstall(CountTo); 8 withInstall(CountTo);
7 -export { CountTo };  
src/components/Description/index.ts
1 -import Description from './src/index';  
2 -  
3 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
4 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const Description = createAsyncComponent(() => import('./src/index'));
  5 +
5 withInstall(Description); 6 withInstall(Description);
6 7
7 export * from './src/types'; 8 export * from './src/types';
8 export { useDescription } from './src/useDescription'; 9 export { useDescription } from './src/useDescription';
9 -export { Description };  
src/components/Drawer/index.ts
1 -import BasicDrawer from './src/BasicDrawer';  
2 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
3 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const BasicDrawer = createAsyncComponent(() => import('./src/BasicDrawer'));
  5 +
4 withInstall(BasicDrawer); 6 withInstall(BasicDrawer);
5 export * from './src/types'; 7 export * from './src/types';
6 export { useDrawer, useDrawerInner } from './src/useDrawer'; 8 export { useDrawer, useDrawerInner } from './src/useDrawer';
7 -export { BasicDrawer };  
src/components/Dropdown/index.ts
1 -import Dropdown from './src/Dropdown';  
2 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
3 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const Dropdown = createAsyncComponent(() => import('./src/Dropdown'));
  5 +
4 withInstall(Dropdown); 6 withInstall(Dropdown);
5 export * from './src/types'; 7 export * from './src/types';
6 -  
7 -export { Dropdown };  
src/components/Excel/index.ts
1 -import ImportExcel from './src/ImportExcel.vue';  
2 -import ExportExcelModel from './src/ExportExcelModel.vue'; 1 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
3 2
4 import { withInstall } from '../util'; 3 import { withInstall } from '../util';
5 4
6 -withInstall(ImportExcel, ExportExcelModel); 5 +export const ImpExcel = createAsyncComponent(() => import('./src/ImportExcel.vue'));
  6 +export const ExpExcelModel = createAsyncComponent(() => import('./src/ExportExcelModel.vue'));
  7 +
  8 +withInstall(ImpExcel, ExpExcelModel);
7 9
8 export * from './src/types'; 10 export * from './src/types';
9 11
10 export { jsonToSheetXlsx, aoaToSheetXlsx } from './src/Export2Excel'; 12 export { jsonToSheetXlsx, aoaToSheetXlsx } from './src/Export2Excel';
11 -  
12 -export { ImportExcel, ExportExcelModel };  
src/components/Icon/index.tsx
1 import './index.less'; 1 import './index.less';
2 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +
3 import type { PropType } from 'vue'; 5 import type { PropType } from 'vue';
4 import { 6 import {
5 defineComponent, 7 defineComponent,
@@ -14,7 +16,7 @@ import { @@ -14,7 +16,7 @@ import {
14 import Iconify from '@purge-icons/generated'; 16 import Iconify from '@purge-icons/generated';
15 import { isString } from '/@/utils/is'; 17 import { isString } from '/@/utils/is';
16 import { propTypes } from '/@/utils/propTypes'; 18 import { propTypes } from '/@/utils/propTypes';
17 -export default defineComponent({ 19 +const Icon = defineComponent({
18 name: 'GIcon', 20 name: 'GIcon',
19 props: { 21 props: {
20 // icon name 22 // icon name
@@ -81,3 +83,9 @@ export default defineComponent({ @@ -81,3 +83,9 @@ export default defineComponent({
81 ); 83 );
82 }, 84 },
83 }); 85 });
  86 +
  87 +export default createAsyncComponent(() => {
  88 + return new Promise((resolve) => {
  89 + resolve(Icon);
  90 + });
  91 +});
src/components/Loading/index.ts
1 import './src/indicator'; 1 import './src/indicator';
2 -import Loading from './src/index.vue';  
3 import { withInstall } from '../util'; 2 import { withInstall } from '../util';
4 3
  4 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  5 +export const Loading = createAsyncComponent(() => import('./src/index.vue'));
  6 +
5 withInstall(Loading); 7 withInstall(Loading);
6 export { useLoading } from './src/useLoading'; 8 export { useLoading } from './src/useLoading';
7 export { createLoading } from './src/createLoading'; 9 export { createLoading } from './src/createLoading';
8 -  
9 -export { Loading };  
src/components/Markdown/index.ts
1 -import MarkDown from './src/index.vue';  
2 -  
3 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
4 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const MarkDown = createAsyncComponent(() => import('./src/index.vue'));
  5 +
5 withInstall(MarkDown); 6 withInstall(MarkDown);
6 7
7 export * from './src/types'; 8 export * from './src/types';
8 -  
9 -export { MarkDown };  
src/components/Menu/index.ts
1 -import BasicMenu from './src/BasicMenu';  
2 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
3 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +
  5 +export const BasicMenu = createAsyncComponent(() => import('./src/BasicMenu'), { loading: false });
  6 +
4 withInstall(BasicMenu); 7 withInstall(BasicMenu);
5 -export { BasicMenu };  
src/components/Modal/index.ts
1 import './src/index.less'; 1 import './src/index.less';
2 -import BasicModal from './src/BasicModal';  
3 import { withInstall } from '../util'; 2 import { withInstall } from '../util';
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +
  5 +export const BasicModal = createAsyncComponent(() => import('./src/BasicModal'));
4 6
5 withInstall(BasicModal); 7 withInstall(BasicModal);
6 8
7 export { useModalContext } from './src/useModalContext'; 9 export { useModalContext } from './src/useModalContext';
8 export { useModal, useModalInner } from './src/useModal'; 10 export { useModal, useModalInner } from './src/useModal';
9 export * from './src/types'; 11 export * from './src/types';
10 -export { BasicModal };  
src/components/Page/index.ts
1 -import PageFooter from './src/PageFooter.vue';  
2 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
3 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const PageFooter = createAsyncComponent(() => import('./src/PageFooter.vue'));
  5 +
4 withInstall(PageFooter); 6 withInstall(PageFooter);
5 -export { PageFooter };  
src/components/Qrcode/index.ts
1 -export { default as QrCode } from './src/index.vue'; 1 +import { withInstall } from '../util';
  2 +
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const QrCode = createAsyncComponent(() => import('./src/index.vue'));
  5 +
  6 +withInstall(QrCode);
2 export * from './src/types'; 7 export * from './src/types';
src/components/Scrollbar/index.ts
@@ -2,10 +2,11 @@ @@ -2,10 +2,11 @@
2 * copy from element-ui 2 * copy from element-ui
3 */ 3 */
4 4
5 -import Scrollbar from './src/Scrollbar';  
6 import { withInstall } from '../util'; 5 import { withInstall } from '../util';
7 6
  7 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  8 +export const Scrollbar = createAsyncComponent(() => import('./src/Scrollbar'));
  9 +
8 withInstall(Scrollbar); 10 withInstall(Scrollbar);
9 11
10 -export { Scrollbar };  
11 export type { ScrollbarType } from './src/types'; 12 export type { ScrollbarType } from './src/types';
src/components/StrengthMeter/index.tsx
1 -import StrengthMeter from './src/index';  
2 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
3 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +
  5 +export const StrengthMeter = createAsyncComponent(() => import('./src/index'));
  6 +
4 withInstall(StrengthMeter); 7 withInstall(StrengthMeter);
5 -export { StrengthMeter };  
src/components/Tinymce/index.ts
1 -import Tinymce from './src/Editor.vue';  
2 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
3 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const Tinymce = createAsyncComponent(() => import('./src/Editor.vue'));
  5 +
4 withInstall(Tinymce); 6 withInstall(Tinymce);
5 -export { Tinymce };  
src/components/Transition/index.ts
1 import { createSimpleTransition, createJavascriptTransition } from './src/CreateTransition'; 1 import { createSimpleTransition, createJavascriptTransition } from './src/CreateTransition';
  2 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
2 3
3 import ExpandTransitionGenerator from './src/ExpandTransition'; 4 import ExpandTransitionGenerator from './src/ExpandTransition';
4 5
@@ -28,4 +29,4 @@ export const ExpandXTransition = createJavascriptTransition( @@ -28,4 +29,4 @@ export const ExpandXTransition = createJavascriptTransition(
28 ExpandTransitionGenerator('', true) 29 ExpandTransitionGenerator('', true)
29 ); 30 );
30 31
31 -export { default as ExpandTransition } from './src/ExpandTransition.vue'; 32 +export const ExpandTransition = createAsyncComponent(() => import('./src/ExpandTransition.vue'));
src/components/Tree/index.ts
1 -export { default as BasicTree } from './src/BasicTree';  
2 -export * from './src/types'; 1 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  2 +import { withInstall } from '../util';
  3 +
  4 +export const BasicTree = createAsyncComponent(() => import('./src/BasicTree'));
  5 +
  6 +withInstall(BasicTree);
  7 +
3 export type { ContextMenuItem } from '/@/hooks/web/useContextMenu'; 8 export type { ContextMenuItem } from '/@/hooks/web/useContextMenu';
  9 +export * from './src/types';
src/components/Upload/index.ts
1 -import BasicUpload from './src/BasicUpload.vue';  
2 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
3 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +export const BasicUpload = createAsyncComponent(() => import('./src/BasicUpload.vue'));
  5 +
4 withInstall(BasicUpload); 6 withInstall(BasicUpload);
5 -export { BasicUpload };  
src/components/Verify/index.ts
1 -import BasicDragVerify from './src/DragVerify';  
2 -import RotateDragVerify from './src/ImgRotate';  
3 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
4 2
  3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +
  5 +export const BasicDragVerify = createAsyncComponent(() => import('./src/DragVerify'));
  6 +export const RotateDragVerify = createAsyncComponent(() => import('./src/ImgRotate'));
  7 +
5 withInstall(BasicDragVerify, RotateDragVerify); 8 withInstall(BasicDragVerify, RotateDragVerify);
6 9
7 export * from './src/types'; 10 export * from './src/types';
8 -  
9 -export { BasicDragVerify, RotateDragVerify };  
src/components/VirtualScroll/index.ts
1 -import VirtualScroll from './src/index';  
2 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
3 2
4 -withInstall(VirtualScroll);  
5 -export { VirtualScroll }; 3 +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  4 +
  5 +export const VScroll = createAsyncComponent(() => import('./src/index'));
  6 +
  7 +withInstall(VScroll);
src/design/ant/btn.less
1 // button重置 1 // button重置
2 .ant-btn { 2 .ant-btn {
  3 + display: inline-flex;
  4 + justify-content: center;
  5 + align-items: center;
3 // &.ant-btn-success:not(.ant-btn-link), 6 // &.ant-btn-success:not(.ant-btn-link),
4 // &.ant-btn-error:not(.ant-btn-link), 7 // &.ant-btn-error:not(.ant-btn-link),
5 // &.ant-btn-warning:not(.ant-btn-link), 8 // &.ant-btn-warning:not(.ant-btn-link),
src/layouts/page/index.tsx
@@ -54,7 +54,10 @@ export default defineComponent({ @@ -54,7 +54,10 @@ export default defineComponent({
54 renderComp() 54 renderComp()
55 ); 55 );
56 56
57 - return unref(getEnableTransition) ? ( 57 + if (!unref(getEnableTransition)) {
  58 + return PageContent;
  59 + }
  60 + return (
58 <Transition 61 <Transition
59 name={name || route.meta.transitionName || unref(getBasicTransition)} 62 name={name || route.meta.transitionName || unref(getBasicTransition)}
60 mode="out-in" 63 mode="out-in"
@@ -62,8 +65,6 @@ export default defineComponent({ @@ -62,8 +65,6 @@ export default defineComponent({
62 > 65 >
63 {() => PageContent} 66 {() => PageContent}
64 </Transition> 67 </Transition>
65 - ) : (  
66 - PageContent  
67 ); 68 );
68 }, 69 },
69 }} 70 }}
src/utils/factory/createAsyncComponent.tsx
1 -import { defineAsyncComponent } from 'vue'; 1 +import {
  2 + defineAsyncComponent,
  3 + // FunctionalComponent, CSSProperties
  4 +} from 'vue';
2 import { Spin } from 'ant-design-vue'; 5 import { Spin } from 'ant-design-vue';
3 import { noop } from '/@/utils/index'; 6 import { noop } from '/@/utils/index';
  7 +
  8 +// const Loading: FunctionalComponent<{ size: 'small' | 'default' | 'large' }> = (props) => {
  9 +// const style: CSSProperties = {
  10 +// position: 'absolute',
  11 +// display: 'flex',
  12 +// justifyContent: 'center',
  13 +// alignItems: 'center',
  14 +// };
  15 +// return (
  16 +// <div style={style}>
  17 +// <Spin spinning={true} size={props.size} />
  18 +// </div>
  19 +// );
  20 +// };
  21 +
4 interface Options { 22 interface Options {
5 size?: 'default' | 'small' | 'large'; 23 size?: 'default' | 'small' | 'large';
6 delay?: number; 24 delay?: number;
@@ -10,7 +28,7 @@ interface Options { @@ -10,7 +28,7 @@ interface Options {
10 } 28 }
11 29
12 export function createAsyncComponent(loader: Fn, options: Options = {}) { 30 export function createAsyncComponent(loader: Fn, options: Options = {}) {
13 - const { size = 'small', delay = 100, timeout = 3000, loading = true, retry = true } = options; 31 + const { size = 'small', delay = 100, timeout = 30000, loading = false, retry = true } = options;
14 return defineAsyncComponent({ 32 return defineAsyncComponent({
15 loader, 33 loader,
16 loadingComponent: loading ? <Spin spinning={true} size={size} /> : undefined, 34 loadingComponent: loading ? <Spin spinning={true} size={size} /> : undefined,
src/utils/http/axios/index.ts
@@ -106,7 +106,7 @@ const transform: AxiosTransform = { @@ -106,7 +106,7 @@ const transform: AxiosTransform = {
106 if (apiUrl && isString(apiUrl)) { 106 if (apiUrl && isString(apiUrl)) {
107 config.url = `${apiUrl}${config.url}`; 107 config.url = `${apiUrl}${config.url}`;
108 } 108 }
109 - if (config.method === RequestEnum.GET) { 109 + if (config.method?.toUpperCase() === RequestEnum.GET) {
110 const now = new Date().getTime(); 110 const now = new Date().getTime();
111 if (!isString(config.params)) { 111 if (!isString(config.params)) {
112 config.data = { 112 config.data = {
@@ -157,14 +157,13 @@ const transform: AxiosTransform = { @@ -157,14 +157,13 @@ const transform: AxiosTransform = {
157 const { t } = useI18n(); 157 const { t } = useI18n();
158 errorStore.setupErrorHandle(error); 158 errorStore.setupErrorHandle(error);
159 const { response, code, message } = error || {}; 159 const { response, code, message } = error || {};
160 - const msg: string =  
161 - response && response.data && response.data.error ? response.data.error.message : '';  
162 - const err: string = error.toString(); 160 + const msg: string = response?.data?.error ? response.data.error.message : '';
  161 + const err: string = error?.toString();
163 try { 162 try {
164 if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) { 163 if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) {
165 createMessage.error(t('sys.api.apiTimeoutMessage')); 164 createMessage.error(t('sys.api.apiTimeoutMessage'));
166 } 165 }
167 - if (err && err.includes('Network Error')) { 166 + if (err?.includes('Network Error')) {
168 createErrorModal({ 167 createErrorModal({
169 title: t('sys.api.networkException'), 168 title: t('sys.api.networkException'),
170 content: t('sys.api.networkExceptionMsg'), 169 content: t('sys.api.networkExceptionMsg'),
@@ -173,7 +172,7 @@ const transform: AxiosTransform = { @@ -173,7 +172,7 @@ const transform: AxiosTransform = {
173 } catch (error) { 172 } catch (error) {
174 throw new Error(error); 173 throw new Error(error);
175 } 174 }
176 - checkStatus(error.response && error.response.status, msg); 175 + checkStatus(error?.response?.status, msg);
177 return Promise.reject(error); 176 return Promise.reject(error);
178 }, 177 },
179 }; 178 };
src/views/demo/comp/button/index.vue
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 49
50 <div class="my-2"> 50 <div class="my-2">
51 <h3>primary</h3> 51 <h3>primary</h3>
52 - <a-button type="primary">主按钮</a-button> 52 + <a-button type="primary" preIcon="mdi:page-next-outline">主按钮</a-button>
53 <a-button type="primary" class="ml-2" disabled> 禁用 </a-button> 53 <a-button type="primary" class="ml-2" disabled> 禁用 </a-button>
54 <a-button type="primary" class="ml-2" loading> loading </a-button> 54 <a-button type="primary" class="ml-2" loading> loading </a-button>
55 <a-button type="link" class="ml-2"> link </a-button> 55 <a-button type="link" class="ml-2"> link </a-button>
src/views/demo/comp/scroll/VirtualScroll.vue
@@ -2,26 +2,26 @@ @@ -2,26 +2,26 @@
2 <div class="p-4 virtual-scroll-demo"> 2 <div class="p-4 virtual-scroll-demo">
3 <Divider>基础滚动示例</Divider> 3 <Divider>基础滚动示例</Divider>
4 <div class="virtual-scroll-demo-wrap"> 4 <div class="virtual-scroll-demo-wrap">
5 - <VirtualScroll :itemHeight="41" :items="data" :height="300" :width="300"> 5 + <VScroll :itemHeight="41" :items="data" :height="300" :width="300">
6 <template v-slot="{ item }"> 6 <template v-slot="{ item }">
7 <div class="virtual-scroll-demo__item">{{ item.title }}</div> 7 <div class="virtual-scroll-demo__item">{{ item.title }}</div>
8 </template> 8 </template>
9 - </VirtualScroll> 9 + </VScroll>
10 </div> 10 </div>
11 11
12 <Divider>即使不可见,也预先加载50条数据,防止空白</Divider> 12 <Divider>即使不可见,也预先加载50条数据,防止空白</Divider>
13 <div class="virtual-scroll-demo-wrap"> 13 <div class="virtual-scroll-demo-wrap">
14 - <VirtualScroll :itemHeight="41" :items="data" :height="300" :width="300" :bench="50"> 14 + <VScroll :itemHeight="41" :items="data" :height="300" :width="300" :bench="50">
15 <template v-slot="{ item }"> 15 <template v-slot="{ item }">
16 <div class="virtual-scroll-demo__item">{{ item.title }}</div> 16 <div class="virtual-scroll-demo__item">{{ item.title }}</div>
17 </template> 17 </template>
18 - </VirtualScroll> 18 + </VScroll>
19 </div> 19 </div>
20 </div> 20 </div>
21 </template> 21 </template>
22 <script lang="ts"> 22 <script lang="ts">
23 import { defineComponent } from 'vue'; 23 import { defineComponent } from 'vue';
24 - import { VirtualScroll } from '/@/components/VirtualScroll/index'; 24 + import { VScroll } from '/@/components/VirtualScroll/index';
25 25
26 import { Divider } from 'ant-design-vue'; 26 import { Divider } from 'ant-design-vue';
27 const data: any[] = (() => { 27 const data: any[] = (() => {
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 return arr; 34 return arr;
35 })(); 35 })();
36 export default defineComponent({ 36 export default defineComponent({
37 - components: { VirtualScroll, Divider }, 37 + components: { VScroll: VScroll, Divider },
38 setup() { 38 setup() {
39 return { data: data }; 39 return { data: data };
40 }, 40 },
src/views/demo/comp/verify/index.vue
@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
2 <div class="p-10"> 2 <div class="p-10">
3 <div class="flex justify-center p-4 items-center bg-gray-700"> 3 <div class="flex justify-center p-4 items-center bg-gray-700">
4 <BasicDragVerify ref="el1" @success="handleSuccess" /> 4 <BasicDragVerify ref="el1" @success="handleSuccess" />
5 - <a-button color="primary" class="ml-2" @click="handleBtnClick(el1)">还原</a-button> 5 + <a-button type="primary" class="ml-2" @click="handleBtnClick(el1)">还原</a-button>
6 </div> 6 </div>
7 7
8 <div class="flex justify-center p-4 items-center bg-gray-700"> 8 <div class="flex justify-center p-4 items-center bg-gray-700">
9 <BasicDragVerify ref="el2" @success="handleSuccess" circle /> 9 <BasicDragVerify ref="el2" @success="handleSuccess" circle />
10 - <a-button color="primary" class="ml-2" @click="handleBtnClick(el2)">还原</a-button> 10 + <a-button type="primary" class="ml-2" @click="handleBtnClick(el2)">还原</a-button>
11 </div> 11 </div>
12 12
13 <div class="flex justify-center p-4 items-center bg-gray-700"> 13 <div class="flex justify-center p-4 items-center bg-gray-700">
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 background: '#018ffb', 20 background: '#018ffb',
21 }" 21 }"
22 /> 22 />
23 - <a-button color="primary" class="ml-2" @click="handleBtnClick(el3)">还原</a-button> 23 + <a-button type="primary" class="ml-2" @click="handleBtnClick(el3)">还原</a-button>
24 </div> 24 </div>
25 25
26 <div class="flex justify-center p-4 items-center bg-gray-700"> 26 <div class="flex justify-center p-4 items-center bg-gray-700">
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 <RightOutlined v-else /> 30 <RightOutlined v-else />
31 </template> 31 </template>
32 </BasicDragVerify> 32 </BasicDragVerify>
33 - <a-button color="primary" class="ml-2" @click="handleBtnClick(el4)">还原</a-button> 33 + <a-button type="primary" class="ml-2" @click="handleBtnClick(el4)">还原</a-button>
34 </div> 34 </div>
35 35
36 <div class="flex justify-center p-4 items-center bg-gray-700"> 36 <div class="flex justify-center p-4 items-center bg-gray-700">
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 </div> 46 </div>
47 </template> 47 </template>
48 </BasicDragVerify> 48 </BasicDragVerify>
49 - <a-button color="primary" class="ml-2" @click="handleBtnClick(el5)">还原</a-button> 49 + <a-button type="primary" class="ml-2" @click="handleBtnClick(el5)">还原</a-button>
50 </div> 50 </div>
51 </div> 51 </div>
52 </template> 52 </template>
src/views/demo/excel/CustomExport.vue
@@ -5,19 +5,19 @@ @@ -5,19 +5,19 @@
5 <a-button @click="openModal">导出</a-button> 5 <a-button @click="openModal">导出</a-button>
6 </template> 6 </template>
7 </BasicTable> 7 </BasicTable>
8 - <ExportExcelModel @register="register" @success="defaultHeader" /> 8 + <ExpExcelModel @register="register" @success="defaultHeader" />
9 </div> 9 </div>
10 </template> 10 </template>
11 11
12 <script lang="ts"> 12 <script lang="ts">
13 import { defineComponent } from 'vue'; 13 import { defineComponent } from 'vue';
14 import { BasicTable } from '/@/components/Table'; 14 import { BasicTable } from '/@/components/Table';
15 - import { jsonToSheetXlsx, ExportExcelModel, ExportModalResult } from '/@/components/Excel'; 15 + import { jsonToSheetXlsx, ExpExcelModel, ExportModalResult } from '/@/components/Excel';
16 import { columns, data } from './data'; 16 import { columns, data } from './data';
17 import { useModal } from '/@/components/Modal'; 17 import { useModal } from '/@/components/Modal';
18 18
19 export default defineComponent({ 19 export default defineComponent({
20 - components: { BasicTable, ExportExcelModel }, 20 + components: { BasicTable, ExpExcelModel },
21 setup() { 21 setup() {
22 function defaultHeader({ filename, bookType }: ExportModalResult) { 22 function defaultHeader({ filename, bookType }: ExportModalResult) {
23 // 默认Object.keys(data[0])作为header 23 // 默认Object.keys(data[0])作为header
src/views/demo/excel/ImportExcel.vue
1 <template> 1 <template>
2 <div class="m-4"> 2 <div class="m-4">
3 - <ImportExcel @success="loadDataSuccess"> 3 + <ImpExcel @success="loadDataSuccess">
4 <a-button class="m-3">导入Excel</a-button> 4 <a-button class="m-3">导入Excel</a-button>
5 - </ImportExcel> 5 + </ImpExcel>
6 <BasicTable 6 <BasicTable
7 v-for="(table, index) in tableListRef" 7 v-for="(table, index) in tableListRef"
8 :key="index" 8 :key="index"
@@ -15,11 +15,11 @@ @@ -15,11 +15,11 @@
15 <script lang="ts"> 15 <script lang="ts">
16 import { defineComponent, ref } from 'vue'; 16 import { defineComponent, ref } from 'vue';
17 17
18 - import { ImportExcel, ExcelData } from '/@/components/Excel'; 18 + import { ImpExcel, ExcelData } from '/@/components/Excel';
19 import { BasicTable, BasicColumn } from '/@/components/Table'; 19 import { BasicTable, BasicColumn } from '/@/components/Table';
20 20
21 export default defineComponent({ 21 export default defineComponent({
22 - components: { BasicTable, ImportExcel }, 22 + components: { BasicTable, ImpExcel },
23 23
24 setup() { 24 setup() {
25 const tableListRef = ref< 25 const tableListRef = ref<