提交 | 用户 | 时间
|
820397
|
1 |
import type { App } from 'vue' |
H |
2 |
// 👇使用 form-create 需额外全局引入 element plus 组件 |
|
3 |
import { |
|
4 |
ElAlert, |
|
5 |
ElAside, |
|
6 |
ElContainer, |
|
7 |
ElDivider, |
|
8 |
ElHeader, |
|
9 |
ElMain, |
|
10 |
ElPopconfirm, |
|
11 |
ElTable, |
|
12 |
ElTableColumn, |
|
13 |
ElTabPane, |
|
14 |
ElTabs, |
|
15 |
ElTransfer |
|
16 |
} from 'element-plus' |
|
17 |
import FcDesigner from '@form-create/designer' |
|
18 |
import formCreate from '@form-create/element-ui' |
|
19 |
import install from '@form-create/element-ui/auto-import' |
|
20 |
|
|
21 |
//======================= 自定义组件 ======================= |
|
22 |
import { UploadFile, UploadImg, UploadImgs } from '@/components/UploadFile' |
|
23 |
import { useApiSelect } from '@/components/FormCreate' |
|
24 |
import { Editor } from '@/components/Editor' |
|
25 |
import DictSelect from '@/components/FormCreate/src/components/DictSelect.vue' |
|
26 |
|
|
27 |
const UserSelect = useApiSelect({ |
|
28 |
name: 'UserSelect', |
|
29 |
labelField: 'nickname', |
|
30 |
valueField: 'id', |
|
31 |
url: '/system/user/simple-list' |
|
32 |
}) |
|
33 |
const DeptSelect = useApiSelect({ |
|
34 |
name: 'DeptSelect', |
|
35 |
labelField: 'name', |
|
36 |
valueField: 'id', |
|
37 |
url: '/system/dept/simple-list' |
|
38 |
}) |
|
39 |
const ApiSelect = useApiSelect({ |
|
40 |
name: 'ApiSelect' |
|
41 |
}) |
|
42 |
|
|
43 |
const components = [ |
|
44 |
ElAside, |
|
45 |
ElPopconfirm, |
|
46 |
ElHeader, |
|
47 |
ElMain, |
|
48 |
ElContainer, |
|
49 |
ElDivider, |
|
50 |
ElTransfer, |
|
51 |
ElAlert, |
|
52 |
ElTabs, |
|
53 |
ElTable, |
|
54 |
ElTableColumn, |
|
55 |
ElTabPane, |
|
56 |
UploadImg, |
|
57 |
UploadImgs, |
|
58 |
UploadFile, |
|
59 |
DictSelect, |
|
60 |
UserSelect, |
|
61 |
DeptSelect, |
|
62 |
ApiSelect, |
|
63 |
Editor |
|
64 |
] |
|
65 |
|
|
66 |
// 参考 http://www.form-create.com/v3/element-ui/auto-import.html 文档 |
|
67 |
export const setupFormCreate = (app: App<Element>) => { |
|
68 |
components.forEach((component) => { |
|
69 |
app.component(component.name, component) |
|
70 |
}) |
|
71 |
formCreate.use(install) |
|
72 |
app.use(formCreate) |
|
73 |
app.use(FcDesigner) |
|
74 |
} |