From 577bf788968fd8e240eecb83224729f6da22f849 Mon Sep 17 00:00:00 2001 From: vben Date: Thu, 12 Nov 2020 23:30:13 +0800 Subject: [PATCH] chore: global registration of some components --- CHANGELOG.zh_CN.md | 3 +- src/components/registerGlobComp.ts | 58 +++++++++++++++++++++++++++++- src/setup/ant-design-vue/index.ts | 12 +++++-- 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 39e4b57d..17b9b2c2 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -8,8 +8,9 @@ ### ✨ Features - 表单项的`componentsProps`支持函数类型 -- 菜单新增 tag 显示 +- 菜单新增 tag 显示,支持 4 中类型颜色及 dot 圆点显示 - 新增菜单及顶栏颜色选择配色 +- 增加示例结果页 ### ⚡ Performance Improvements diff --git a/src/components/registerGlobComp.ts b/src/components/registerGlobComp.ts index 5fe283c2..669e1b96 100644 --- a/src/components/registerGlobComp.ts +++ b/src/components/registerGlobComp.ts @@ -1,6 +1,33 @@ import Icon from './Icon/index'; import Button from './Button/index.vue'; -import { Button as AntButton } from 'ant-design-vue'; +import { + // Need + Button as AntButton, + + // Optional + Select, + Checkbox, + DatePicker, + Radio, + Switch, + Card, + List, + Tabs, + Descriptions, + Tree, + Table, + Divider, + Modal, + Drawer, + Dropdown, + Tag, + Tooltip, + Badge, + Popover, + Upload, + Transfer, + Steps, +} from 'ant-design-vue'; import { getApp } from '/@/useApp'; const compList = [Icon, Button, AntButton.Group]; @@ -12,5 +39,34 @@ export function registerGlobComp() { compList.forEach((comp: any) => { getApp().component(comp.name, comp); }); + registered = true; + + // Optional + // Why register here: The main reason for registering here is not to increase the size of the first screen code + // If you need to customize global components, you can write here + // If you don’t need it, you can delete it + getApp() + .use(Select) + .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(Tabs); } diff --git a/src/setup/ant-design-vue/index.ts b/src/setup/ant-design-vue/index.ts index 5478d452..0bb5dd17 100644 --- a/src/setup/ant-design-vue/index.ts +++ b/src/setup/ant-design-vue/index.ts @@ -2,12 +2,20 @@ import type { App } from 'vue'; -import { Form, Input, Row, Col } from 'ant-design-vue'; +import { + // need + Form, + Input, + Row, + Col, + Spin, +} from 'ant-design-vue'; import 'ant-design-vue/dist/antd.css'; import './spin'; export function setupAntd(app: App) { + // need // Here are the components required before registering and logging in - app.use(Form).use(Input).use(Row).use(Col); + app.use(Form).use(Input).use(Row).use(Col).use(Spin); } -- GitLab