diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index a97c3db4d..fd53d714f 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -4,6 +4,10 @@ - 移除左侧菜单搜索,新增顶部菜单搜索功能 +### 🎫 Chores + +- 返回顶部样式调整,避免遮住其他元素 + ## 2.0.0-rc.13 (2020-12-10) ## (破坏性更新) Breaking changes diff --git a/src/components/ClickOutSide/index.ts b/src/components/ClickOutSide/index.ts index 682037cb1..e84e8e00e 100644 --- a/src/components/ClickOutSide/index.ts +++ b/src/components/ClickOutSide/index.ts @@ -1,6 +1,6 @@ -import ClickOutSide from './src/index.vue'; import { withInstall } from '../util'; +import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; + +export const ClickOutSide = createAsyncComponent(() => import('./src/index.vue')); withInstall(ClickOutSide); - -export { ClickOutSide }; diff --git a/src/design/ant/index.less b/src/design/ant/index.less index 2514748d0..5b6ead476 100644 --- a/src/design/ant/index.less +++ b/src/design/ant/index.less @@ -7,6 +7,11 @@ width: 100%; } +.ant-back-top { + right: 20px; + bottom: 20px; +} + .collapse-container__body { > .ant-descriptions { margin-left: 6px; diff --git a/src/router/index.ts b/src/router/index.ts index bedbb1894..6e7d8c5be 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -6,7 +6,7 @@ import { createRouter, createWebHashHistory } from 'vue-router'; import { createGuard } from './guard/'; import { basicRoutes } from './routes/'; -import { scrollBehavior } from './scrollBehaviour'; +import { scrollBehavior } from './scrollBehavior'; export const hashRouter = createWebHashHistory(); diff --git a/src/router/scrollBehaviour.ts b/src/router/scrollBehavior.ts similarity index 100% rename from src/router/scrollBehaviour.ts rename to src/router/scrollBehavior.ts diff --git a/src/utils/factory/createAsyncComponent.tsx b/src/utils/factory/createAsyncComponent.tsx index 41e639ead..123b4f680 100644 --- a/src/utils/factory/createAsyncComponent.tsx +++ b/src/utils/factory/createAsyncComponent.tsx @@ -1,16 +1,25 @@ import { defineAsyncComponent } from 'vue'; import { Spin } from 'ant-design-vue'; +import { noop } from '/@/utils/index'; +interface Options { + size?: 'default' | 'small' | 'large'; + delay?: number; + timeout?: number; + loading?: boolean; + retry?: boolean; +} -export function createAsyncComponent(loader: any) { +export function createAsyncComponent(loader: Fn, options: Options = {}) { + const { size = 'small', delay = 100, timeout = 3000, loading = true, retry = true } = options; return defineAsyncComponent({ - loader: loader, - loadingComponent: , + loader, + loadingComponent: loading ? : undefined, // The error component will be displayed if a timeout is // provided and exceeded. Default: Infinity. - timeout: 3000, + timeout, // Defining if component is suspensible. Default: true. // suspensible: false, - delay: 100, + delay, /** * * @param {*} error Error message object @@ -18,15 +27,17 @@ export function createAsyncComponent(loader: any) { * @param {*} fail End of failure * @param {*} attempts Maximum allowed retries number */ - onError(error, retry, fail, attempts) { - if (error.message.match(/fetch/) && attempts <= 3) { - // retry on fetch errors, 3 max attempts - retry(); - } else { - // Note that retry/fail are like resolve/reject of a promise: - // one of them must be called for the error handling to continue. - fail(); - } - }, + onError: !retry + ? noop + : (error, retry, fail, attempts) => { + if (error.message.match(/fetch/) && attempts <= 3) { + // retry on fetch errors, 3 max attempts + retry(); + } else { + // Note that retry/fail are like resolve/reject of a promise: + // one of them must be called for the error handling to continue. + fail(); + } + }, }); }