Commit 577bf788968fd8e240eecb83224729f6da22f849
1 parent
fc4666ef
chore: global registration of some components
Showing
3 changed files
with
69 additions
and
4 deletions
CHANGELOG.zh_CN.md
src/components/registerGlobComp.ts
1 | 1 | import Icon from './Icon/index'; |
2 | 2 | import Button from './Button/index.vue'; |
3 | -import { Button as AntButton } from 'ant-design-vue'; | |
3 | +import { | |
4 | + // Need | |
5 | + Button as AntButton, | |
6 | + | |
7 | + // Optional | |
8 | + Select, | |
9 | + Checkbox, | |
10 | + DatePicker, | |
11 | + Radio, | |
12 | + Switch, | |
13 | + Card, | |
14 | + List, | |
15 | + Tabs, | |
16 | + Descriptions, | |
17 | + Tree, | |
18 | + Table, | |
19 | + Divider, | |
20 | + Modal, | |
21 | + Drawer, | |
22 | + Dropdown, | |
23 | + Tag, | |
24 | + Tooltip, | |
25 | + Badge, | |
26 | + Popover, | |
27 | + Upload, | |
28 | + Transfer, | |
29 | + Steps, | |
30 | +} from 'ant-design-vue'; | |
4 | 31 | import { getApp } from '/@/useApp'; |
5 | 32 | |
6 | 33 | const compList = [Icon, Button, AntButton.Group]; |
... | ... | @@ -12,5 +39,34 @@ export function registerGlobComp() { |
12 | 39 | compList.forEach((comp: any) => { |
13 | 40 | getApp().component(comp.name, comp); |
14 | 41 | }); |
42 | + | |
15 | 43 | registered = true; |
44 | + | |
45 | + // Optional | |
46 | + // Why register here: The main reason for registering here is not to increase the size of the first screen code | |
47 | + // If you need to customize global components, you can write here | |
48 | + // If you don’t need it, you can delete it | |
49 | + getApp() | |
50 | + .use(Select) | |
51 | + .use(Checkbox) | |
52 | + .use(DatePicker) | |
53 | + .use(Radio) | |
54 | + .use(Switch) | |
55 | + .use(Card) | |
56 | + .use(List) | |
57 | + .use(Descriptions) | |
58 | + .use(Tree) | |
59 | + .use(Table) | |
60 | + .use(Divider) | |
61 | + .use(Modal) | |
62 | + .use(Drawer) | |
63 | + .use(Dropdown) | |
64 | + .use(Tag) | |
65 | + .use(Tooltip) | |
66 | + .use(Badge) | |
67 | + .use(Popover) | |
68 | + .use(Upload) | |
69 | + .use(Transfer) | |
70 | + .use(Steps) | |
71 | + .use(Tabs); | |
16 | 72 | } | ... | ... |
src/setup/ant-design-vue/index.ts
... | ... | @@ -2,12 +2,20 @@ |
2 | 2 | |
3 | 3 | import type { App } from 'vue'; |
4 | 4 | |
5 | -import { Form, Input, Row, Col } from 'ant-design-vue'; | |
5 | +import { | |
6 | + // need | |
7 | + Form, | |
8 | + Input, | |
9 | + Row, | |
10 | + Col, | |
11 | + Spin, | |
12 | +} from 'ant-design-vue'; | |
6 | 13 | import 'ant-design-vue/dist/antd.css'; |
7 | 14 | |
8 | 15 | import './spin'; |
9 | 16 | |
10 | 17 | export function setupAntd(app: App<Element>) { |
18 | + // need | |
11 | 19 | // Here are the components required before registering and logging in |
12 | - app.use(Form).use(Input).use(Row).use(Col); | |
20 | + app.use(Form).use(Input).use(Row).use(Col).use(Spin); | |
13 | 21 | } | ... | ... |