general-basic-form 2.0.53 → 2.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +987 -0
  3. package/dist/index.umd.cjs +1 -0
  4. package/dist/style.css +1 -0
  5. package/package.json +14 -3
  6. package/README.assets/image-20210820173738506.png +0 -0
  7. package/script/link.ts +0 -36
  8. package/script/unlink.ts +0 -45
  9. package/src/Descriptions.vue +0 -106
  10. package/src/GeneralBasicForm.vue +0 -277
  11. package/src/InfiniteScrollList.vue +0 -170
  12. package/src/assets/image-20210820173037871.png +0 -0
  13. package/src/assets/logo.png +0 -0
  14. package/src/components/CustomCom/img-mask/index.vue +0 -79
  15. package/src/components/CustomCom/input-graphic-verification/index.vue +0 -82
  16. package/src/components/CustomCom/input-mobile-verification/index.vue +0 -52
  17. package/src/components/CustomCom/input-mobile-verification/verification-button.vue +0 -81
  18. package/src/components/VABasic/input/index.vue +0 -75
  19. package/src/components/VBasic/cascader/index.vue +0 -32
  20. package/src/components/VBasic/checkbox/index.vue +0 -37
  21. package/src/components/VBasic/date-picker/index.vue +0 -31
  22. package/src/components/VBasic/divider/index.vue +0 -53
  23. package/src/components/VBasic/input/index.vue +0 -67
  24. package/src/components/VBasic/input-number/index.vue +0 -31
  25. package/src/components/VBasic/radio/index.vue +0 -37
  26. package/src/components/VBasic/select/index.vue +0 -37
  27. package/src/components/setting.ts +0 -28
  28. package/src/index.ts +0 -30
  29. package/src/injectKey.ts +0 -2
  30. package/src/types/basicFrom.ts +0 -63
  31. package/src/types/componentType.ts +0 -6
  32. package/src/types/componentsProps.ts +0 -18
  33. package/tsconfig.json +0 -14
  34. package/vite.config.js +0 -123
  35. /package/{public → dist}/index.d.ts +0 -0
@@ -1,170 +0,0 @@
1
- <!--
2
- * @Author: 陈德立*******419287484@qq.com
3
- * @Date: 2023-12-05 15:09:03
4
- * @LastEditTime: 2024-07-16 10:46:16
5
- * @LastEditors: 陈德立*******419287484@qq.com
6
- * @Github: https://github.com/Alan1034
7
- * @Description: 公共的无限滚动列表
8
- * @FilePath: \GeneralBasicForm\src\InfiniteScrollList.vue
9
- *
10
- -->
11
- <template>
12
- <el-checkbox-group
13
- v-model="checkedList"
14
- v-loading="loading"
15
- v-bind="props"
16
- v-if="props.checkbox"
17
- >
18
- <ul
19
- v-infinite-scroll="loadList"
20
- class="list"
21
- :infinite-scroll-disabled="ifbottom"
22
- >
23
- <li v-for="i in list" :key="i[id]" class="list-item">
24
- <el-checkbox :value="i[id]" class="checkbox"
25
- >{{ i[name] }}
26
- <ExtraComponent :i="i" v-if="props.extra"></ExtraComponent>
27
- </el-checkbox>
28
- </li>
29
- </ul>
30
- </el-checkbox-group>
31
- <ul
32
- v-infinite-scroll="loadList"
33
- class="list"
34
- :infinite-scroll-disabled="ifbottom"
35
- v-else
36
- v-bind="props"
37
- >
38
- <li v-for="i in list" :key="i[id]" class="list-item">
39
- <div class="checkbox">
40
- {{ i[name] }}
41
- <ExtraComponent :i="i" v-if="props.extra"></ExtraComponent>
42
- </div>
43
- </li>
44
- </ul>
45
- </template>
46
-
47
- <script lang="ts" setup>
48
- import { ref, computed, watch } from "vue";
49
- import type { PropType, FunctionalComponent, VNode } from "vue";
50
- type SearchFunction = (page: Number) => Promise<[]>;
51
- type ExtraFunction = "false" | ((item: any) => VNode | String);
52
- const props = defineProps({
53
- search: {
54
- type: Function as PropType<SearchFunction>,
55
- required: true,
56
- },
57
- checkbox: {
58
- type: Boolean,
59
- required: false,
60
- },
61
- id: {
62
- type: String,
63
- required: true,
64
- },
65
- name: {
66
- type: String,
67
- required: true,
68
- },
69
- extra: {
70
- type: null as PropType<ExtraFunction>,
71
- required: false,
72
- },
73
- defaultSelection: {
74
- type: Array,
75
- required: false,
76
- },
77
- });
78
- const { search, id, name, extra } = props;
79
- const list = ref<any[]>([]);
80
- const page = ref(1);
81
- const ifbottom = ref(false); //判断是否到底部,是的话就不再请求
82
- const checkedList = ref<any[]>([]);
83
- const loading = ref(false);
84
- type ExtraComponentProps = {
85
- i: any;
86
- };
87
- type Events = {};
88
- // 函数直接返回VNode模板会识别成[object Promise],因此需要转换成函数式组件
89
- const ExtraComponent: FunctionalComponent<ExtraComponentProps, Events> = (
90
- props,
91
- context
92
- ) => {
93
- const { i } = props;
94
- // el-checkbox有固定高度,如果需要配置高度比较高,例如有换行的自定义extra,最好处理一下样式,例子:
95
- // :deep(.el-checkbox) {
96
- // padding: 6px 16px !important;
97
- // display: flex;
98
- // align-items: baseline;
99
- // height: auto;
100
- // }
101
- return extra && extra !== "false" ? extra(i) : "";
102
- };
103
- const updateCheckedList = (newSelection: any[]) => {
104
- checkedList.value = newSelection.map((item) => {
105
- return typeof item === "object" ? item[id] : item;
106
- });
107
- };
108
- watch(
109
- () => props.defaultSelection,
110
- (NewVal = [], oldVal = []) => {
111
- updateCheckedList(NewVal);
112
- },
113
- { immediate: true }
114
- );
115
- const reset = () => {
116
- lowReset();
117
- checkedList.value = [];
118
- };
119
- const lowReset = () => {
120
- page.value = 1;
121
- list.value = [];
122
- ifbottom.value = false;
123
- };
124
- const loadList = async () => {
125
- if (loading.value) {
126
- return;
127
- }
128
- if (ifbottom.value) {
129
- return;
130
- }
131
- loading.value = true;
132
- const resList = await search(page.value);
133
- if (resList && resList.length > 0) {
134
- list.value = [...list.value, ...resList];
135
- page.value += 1;
136
- } else {
137
- ifbottom.value = true;
138
- }
139
- loading.value = false;
140
- };
141
- const refreshList = () => {
142
- lowReset();
143
- loadList();
144
- };
145
- const selectInfo =
146
- computed(() =>
147
- list.value.filter((item) => checkedList.value.includes(item[id]))
148
- ) || {};
149
- defineExpose({
150
- reset,
151
- lowReset,
152
- loadList,
153
- selectInfo,
154
- list,
155
- ifbottom,
156
- refreshList,
157
- });
158
- </script>
159
-
160
- <style lang="less" scoped>
161
- .list {
162
- height: 272px;
163
- overflow: auto;
164
- padding: 8px 0px;
165
- .checkbox {
166
- width: calc(100% - 32px);
167
- padding: 0 16px;
168
- }
169
- }
170
- </style>
Binary file
@@ -1,79 +0,0 @@
1
- <!-- @format -->
2
-
3
- <!--
4
- * @Author: 陈德立*******419287484@qq.com
5
- * @Date: 2024-09-05 16:09:07
6
- * @LastEditTime: 2024-09-05 17:11:51
7
- * @LastEditors: 陈德立*******419287484@qq.com
8
- * @Github: https://github.com/Alan1034
9
- * @Description: 制作遮罩层图片打碎与重组循环动画
10
- * @FilePath: \GeneralBasicForm\src\components\CustomCom\img-mask\index.vue
11
- *
12
- -->
13
- <!-- @format -->
14
-
15
- <template>
16
- <canvas ref="loadingCanvas"></canvas>
17
- </template>
18
- <script setup lang="ts">
19
- import { onMounted, ref } from "vue";
20
- const loadingCanvas = ref() as any
21
- const { imgSrc } = defineProps<{ imgSrc: string }>();
22
- onMounted(() => {
23
- const img = new Image();
24
- const pieces = [];
25
- const piecesX = 8; // Number of horizontal pieces
26
- const piecesY = 8; // Number of vertical pieces
27
- let pieceHeight = 0;
28
- let pieceWidth = 0;
29
- const shatterAngle = 300; //
30
- const canvas = loadingCanvas.value;
31
- const ctx = canvas.getContext('2d');
32
- img.onload = function () {
33
- canvas.width = img.width;
34
- canvas.height = img.height;
35
- pieceWidth = Math.floor(img.width / piecesX);
36
- pieceHeight = Math.floor(img.height / piecesY);
37
- shatterImage();
38
- animate(); // 开始对碎片的动画处理
39
- };
40
- img.src = imgSrc;
41
- const shatterImage = () => {
42
- for (let i = 0; i < piecesY; i++) {
43
- for (let j = 0; j < piecesX; j++) {
44
- pieces.push({
45
- x: pieceWidth * j,
46
- y: pieceHeight * i,
47
- offsetX: (Math.random() - 0.5) * shatterAngle,
48
- offsetY: (Math.random() - 0.5) * shatterAngle
49
- });
50
- }
51
- }
52
- }
53
- const animate = () => {
54
- ctx.clearRect(0, 0, canvas.width, canvas.height);
55
- let renderFinish = true
56
- pieces.forEach((piece, index) => {
57
- ctx.drawImage(img, piece.x, piece.y, pieceWidth, pieceHeight, piece.x + piece.offsetX, piece.y + piece.offsetY, pieceWidth, pieceHeight);
58
- // Gradually reposition pieces to original position
59
- if (Math.abs(piece.offsetX) > 0.5) {
60
- renderFinish = false
61
- piece.offsetX *= 0.95;
62
- }
63
- if (Math.abs(piece.offsetY) > 0.5) {
64
- piece.offsetY *= 0.95;
65
- renderFinish = false
66
- }
67
- });
68
- if (renderFinish) {
69
- setTimeout(() => {
70
- shatterImage();
71
- animate();
72
- }, 300);
73
- } else {
74
- requestAnimationFrame(animate);
75
- }
76
-
77
- }
78
- })
79
- </script>
@@ -1,82 +0,0 @@
1
- <!-- @format -->
2
-
3
- <!--
4
- * @Author: 陈德立*******419287484@qq.com
5
- * @Date: 2023-11-09 10:01:20
6
- * @LastEditTime: 2024-09-05 17:07:07
7
- * @LastEditors: 陈德立*******419287484@qq.com
8
- * @Github: https://github.com/Alan1034
9
- * @Description: 图形验证码组件
10
- * @FilePath: \GeneralBasicForm\src\components\CustomCom\input-graphic-verification\index.vue
11
- *
12
- -->
13
-
14
- <script setup lang="ts">
15
- import EInput from "../../VBasic/input/index.vue";
16
- import AInput from "../../VABasic/input/index.vue";
17
- import anime from 'animejs/lib/anime.es.js';
18
- import { inject, shallowRef, computed } from "vue";
19
- import { formLoadingKey } from "../../../injectKey";
20
- import ImgMask from "../img-mask/index.vue";
21
- import type { InputGraphicVerification } from "../../../types/componentsProps";
22
- import type { ComponentType } from "../../../types/componentType";
23
- const { item, componentType = "Element Plus", loading = false } = defineProps<{ item: any, componentType?: ComponentType, loading?: boolean }>();
24
- const {
25
- graphicSrc = "",
26
- graphicAlt = "",
27
- getGraphic = () => { },
28
- key,
29
- }: InputGraphicVerification = item;
30
-
31
- const { formLoading } = inject<any>(formLoadingKey, false);
32
- const verificationLoading = computed(() => {
33
- return formLoading?.value || loading
34
- })
35
- const graphicClick = async () => {
36
- // console.log('click', getGraphic);
37
- if (getGraphic && !verificationLoading?.value) {
38
- await getGraphic();
39
-
40
- }
41
- };
42
-
43
- const inputType = shallowRef(EInput)
44
-
45
- switch (componentType) {
46
- case "Element Plus":
47
- inputType.value = EInput
48
- break;
49
- case "Ant Design Vue":
50
- inputType.value = AInput
51
- break;
52
- default:
53
- break;
54
- }
55
- </script>
56
-
57
- <template>
58
- <div class="input-graphic-verification">
59
- <component :is="inputType" :item="item" class="input" />
60
- <ImgMask class="graphic" :imgSrc="graphicSrc" v-if="verificationLoading" />
61
- <img v-else class="graphic" @click="graphicClick" :src="graphicSrc" :alt="graphicAlt || `${key}`" />
62
- </div>
63
- </template>
64
-
65
- <style lang="less" scoped>
66
- .input-graphic-verification {
67
- display: flex;
68
- gap: 12px;
69
- width: 100%;
70
-
71
- .input {
72
- flex: auto;
73
- }
74
-
75
- .graphic {
76
- width: 108px;
77
- height: 43px;
78
- object-fit: fill;
79
- flex: none;
80
- }
81
- }
82
- </style>
@@ -1,52 +0,0 @@
1
- <!--
2
- * @Author: 陈德立*******419287484@qq.com
3
- * @Date: 2023-11-09 10:01:20
4
- * @LastEditTime: 2024-09-18 10:47:17
5
- * @LastEditors: 陈德立*******419287484@qq.com
6
- * @Github: https://github.com/Alan1034
7
- * @Description: 手机验证码组件
8
- * @FilePath: \GeneralBasicForm\src\components\CustomCom\input-mobile-verification\index.vue
9
- *
10
- -->
11
-
12
- <script setup lang="ts">
13
- import EInput from "../../VBasic/input/index.vue";
14
- import AInput from "../../VABasic/input/index.vue";
15
- import { h, shallowRef } from "vue";
16
- import type { ComponentType } from "../../../types/componentType";
17
- import VerificationButton from "./verification-button.vue";
18
- const { item, componentType = "Element Plus" } = defineProps<{ item: any, componentType?: ComponentType }>();
19
- // 重新赋值一下触发下面的代码,否则响应会在内部进行
20
- const mobileItem = item;
21
- const inputType = <any>shallowRef(EInput)
22
- switch (componentType) {
23
- case "Element Plus":
24
- inputType.value = EInput;
25
- mobileItem.template = {
26
- append: () => {
27
- return h(VerificationButton, {
28
- getSmscode: mobileItem.getSmscode,
29
- item,
30
- });
31
- },
32
- };
33
- break;
34
- case "Ant Design Vue":
35
- inputType.value = AInput
36
- mobileItem.template = {
37
- suffix: () => {
38
- return h(VerificationButton, {
39
- getSmscode: mobileItem.getSmscode,
40
- item,
41
- });
42
- },
43
- };
44
- break;
45
- default:
46
- break;
47
- }
48
- </script>
49
-
50
- <template>
51
- <component :is="inputType" :item="mobileItem" class="input" />
52
- </template>
@@ -1,81 +0,0 @@
1
- <!--
2
- * @Author: 陈德立*******419287484@qq.com
3
- * @Date: 2024-09-03 15:58:20
4
- * @LastEditTime: 2024-09-18 10:54:40
5
- * @LastEditors: 陈德立*******419287484@qq.com
6
- * @Github: https://github.com/Alan1034
7
- * @Description:
8
- * @FilePath: \GeneralBasicForm\src\components\CustomCom\input-mobile-verification\verification-button.vue
9
- *
10
- -->
11
- <script setup lang="ts">
12
- import { ref, computed, onBeforeUnmount, Ref, shallowRef } from "vue";
13
- import type { ComponentType } from "../../../types/componentType";
14
- const { getSmscode, componentType = "Element Plus", item } = defineProps<{ getSmscode: Function, componentType?: ComponentType, item: any }>();
15
-
16
- const defaultText = "获取验证码";
17
- const restTime = 60;
18
- const buttonText: Ref<string | number> = ref(defaultText);
19
- const timer = ref(null);
20
- const buttonType = computed(() => buttonText.value === defaultText);
21
- const buttonName = shallowRef("el-button")
22
- switch (componentType) {
23
- case "Element Plus":
24
- buttonName.value = "el-button"
25
- break;
26
- case "Ant Design Vue":
27
- buttonName.value = "a-button"
28
- break;
29
- default:
30
- break;
31
- }
32
- const reset = () => {
33
- if (!timer) {
34
- return;
35
- }
36
- clearInterval(timer.value);
37
- timer.value = null;
38
- buttonText.value = defaultText;
39
- };
40
- const buttonClick = async () => {
41
- if (buttonText.value !== defaultText) {
42
- return;
43
- }
44
- buttonText.value = restTime;
45
- timer.value = setInterval(() => {
46
- if (Number(buttonText.value) <= 0 || !buttonText.value) {
47
- reset();
48
- return;
49
- } else {
50
- buttonText.value = Number(buttonText.value) - 1;
51
- }
52
- }, 1000);
53
- if (!getSmscode) {
54
- return;
55
- } else {
56
- const statue = await getSmscode();
57
- if (statue === false) {
58
- reset();
59
- }
60
- }
61
- };
62
- onBeforeUnmount(() => {
63
- reset();
64
- });
65
- const buttonSetting = { ...item.buttonSetting }
66
- </script>
67
-
68
- <template>
69
- <component :is="buttonName" class="verifiaction-button" :style="{
70
- color: buttonType
71
- ? 'var(--color-primary, #409EFF)'
72
- : 'var(--text-color-placeholder, #A8ABB2)',
73
- cursor: buttonType ? 'pointer' : 'default',
74
- }" @click="buttonClick" v-bind="buttonSetting">{{ buttonType ? defaultText : buttonText + "s" }}</component>
75
- </template>
76
-
77
- <style lang="less" scoped>
78
- .verifiaction-button {
79
- width: 109px;
80
- }
81
- </style>
@@ -1,75 +0,0 @@
1
- <!--
2
- * @Author: 陈德立*******419287484@qq.com
3
- * @Date: 2024-09-04 18:01:00
4
- * @LastEditTime: 2024-09-09 19:37:36
5
- * @LastEditors: 陈德立*******419287484@qq.com
6
- * @Github: https://github.com/Alan1034
7
- * @Description:
8
- * @FilePath: \GeneralBasicForm\src\components\VABasic\input\index.vue
9
- *
10
- -->
11
- <template>
12
- <a-input @keydown.enter="getList" @change="onInputChange" :value="queryParams[item.prop]" :size="size"
13
- v-bind="inputSetting">
14
- <template v-for="(templateEle, name) in item.template" #[name]>
15
- <component :key="name" v-if="templateEle" :is="currentInputComponent()" :templateEle="templateEle" />
16
- </template>
17
- </a-input>
18
- </template>
19
-
20
- <script lang="ts">
21
- import { defineComponent, inject } from "vue";
22
- import { inputDefaultSetting } from "../../setting";
23
-
24
- export default defineComponent({
25
- components: {
26
- InputArchive: (props) => {
27
- const { templateEle } = props;
28
- return templateEle();
29
- },
30
- },
31
- props: {
32
- item: null, // null就是any
33
- },
34
- setup() {
35
- const queryParams = inject("queryParams", {});
36
- const getList = inject("getList", () => { });
37
- const size = inject("size", "default");
38
- const Form = inject("Form") as any;
39
- const formItemContext = Form.useInjectFormItemContext();
40
- return { queryParams, getList, size, formItemContext };
41
- },
42
- data() {
43
- return {
44
- inputSetting: {
45
- ...inputDefaultSetting,
46
- ...this.item.inputSetting,
47
- ...this.item.setting,
48
- },
49
- };
50
- },
51
- // created() {
52
- // console.log("new", this.item);
53
- // console.log("new", this.inputSetting);
54
- // },
55
- methods: {
56
- currentInputComponent() {
57
- return "input-archive";
58
- },
59
- onInputChange(e: any) {
60
- this.queryParams[this.item.prop] = (e.target as any).value
61
- this.formItemContext.onFieldChange();
62
- }
63
- },
64
- // watch: {
65
- // item(val) {
66
- // console.log("item", val);
67
- // },
68
- // size(val) {
69
- // console.log(val);
70
- // },
71
- // },
72
- });
73
- </script>
74
-
75
- <style></style>
@@ -1,32 +0,0 @@
1
- <!--
2
- * @Author: 陈德立*******419287484@qq.com
3
- * @Date: 2023-11-08 18:03:42
4
- * @LastEditTime: 2023-12-07 17:06:11
5
- * @LastEditors: 陈德立*******419287484@qq.com
6
- * @Github: https://github.com/Alan1034
7
- * @Description:
8
- * @FilePath: \GeneralBasicForm\src\components\VBasic\cascader\index.vue
9
- *
10
- -->
11
- <script setup lang="ts">
12
- import { selectDefaultSetting } from "../../setting";
13
- import { ref, inject } from "vue";
14
- import { BasicFormComponentsProps } from "../../../types/componentsProps";
15
- const { item } = defineProps<{ item: any }>();
16
- const queryParams = inject("queryParams", {});
17
- const size = inject("size");
18
- const selectSetting = ref({
19
- ...selectDefaultSetting,
20
- ...item.selectSetting,
21
- ...item.setting,
22
- });
23
- </script>
24
-
25
- <template>
26
- <el-cascader
27
- v-model="queryParams[item.prop]"
28
- :size="size"
29
- :options="item.options || []"
30
- v-bind="selectSetting"
31
- ></el-cascader>
32
- </template>
@@ -1,37 +0,0 @@
1
- <!--
2
- * @Author: 陈德立*******419287484@qq.com
3
- * @Date: 2023-11-08 18:03:42
4
- * @LastEditTime: 2023-12-28 14:51:25
5
- * @LastEditors: 陈德立*******419287484@qq.com
6
- * @Github: https://github.com/Alan1034
7
- * @Description: 单选框组件
8
- * @FilePath: \GeneralBasicForm\src\components\VBasic\checkbox\index.vue
9
- *
10
- -->
11
- <script setup lang="ts">
12
- import { ref, inject } from "vue";
13
- // import { BasicFormComponentsProps } from "../../../types/componentsProps";
14
- const { item } = defineProps<{ item: any }>();
15
- const queryParams = inject("queryParams", {});
16
- const size = inject("size");
17
- const checkboxGroupSetting = ref({
18
- ...item.checkboxGroupSetting,
19
- ...item.setting,
20
- });
21
- </script>
22
-
23
- <template>
24
- <el-checkbox-group
25
- v-model="queryParams[item.prop]"
26
- :size="size"
27
- v-bind="checkboxGroupSetting"
28
- >
29
- <el-checkbox
30
- v-for="dict in item.option || []"
31
- :size="size"
32
- :key="dict.value"
33
- v-bind="dict"
34
- >{{ dict.label }}</el-checkbox
35
- >
36
- </el-checkbox-group>
37
- </template>
@@ -1,31 +0,0 @@
1
- <!--
2
- * @Author: 陈德立*******419287484@qq.com
3
- * @Date: 2023-11-08 18:03:42
4
- * @LastEditTime: 2023-12-07 16:49:21
5
- * @LastEditors: 陈德立*******419287484@qq.com
6
- * @Github: https://github.com/Alan1034
7
- * @Description:
8
- * @FilePath: \GeneralBasicForm\src\components\VBasic\date-picker\index.vue
9
- *
10
- -->
11
- <script setup lang="ts">
12
- import { datePackerDefaultSetting } from "../../setting";
13
- import { ref, inject } from "vue";
14
- import { BasicFormComponentsProps } from "../../../types/componentsProps";
15
- const { item } = defineProps<{ item: any }>();
16
- const queryParams = inject("queryParams", {});
17
- const size = inject("size");
18
- const datePackerSetting = ref({
19
- ...datePackerDefaultSetting,
20
- ...item.datePackerSetting,
21
- ...item.setting,
22
- });
23
- </script>
24
-
25
- <template>
26
- <el-date-picker
27
- v-model="queryParams[item.prop]"
28
- :size="size"
29
- v-bind="datePackerSetting"
30
- />
31
- </template>
@@ -1,53 +0,0 @@
1
- <!--
2
- * @Author: 陈德立*******419287484@qq.com
3
- * @Date: 2023-11-09 10:01:20
4
- * @LastEditTime: 2023-11-10 16:51:18
5
- * @LastEditors: 陈德立*******419287484@qq.com
6
- * @Github: https://github.com/Alan1034
7
- * @Description: 分割线
8
- * @FilePath: \deal-front-endd:\work\GeneralBasicForm\src\components\VBasic\divider\index.vue
9
- *
10
- -->
11
-
12
- <template>
13
- <el-divider v-bind="dividerSetting">
14
- <template v-for="(templateEle, name) in item.template" #[name]>
15
- <component
16
- :key="name"
17
- v-if="templateEle"
18
- :is="currentInputComponent()"
19
- :templateEle="templateEle"
20
- />
21
- </template>
22
- </el-divider>
23
- </template>
24
-
25
- <script lang="ts">
26
- import { defineComponent } from "vue";
27
-
28
- export default defineComponent({
29
- components: {
30
- slotArchive: (props) => {
31
- const { templateEle } = props;
32
- return templateEle();
33
- },
34
- },
35
- props: {
36
- item: null, // null就是any
37
- },
38
- setup() {},
39
- data() {
40
- return {
41
- dividerSetting: {
42
- ...this.item.dividerSetting,
43
- ...this.item.setting,
44
- },
45
- };
46
- },
47
- methods: {
48
- currentInputComponent() {
49
- return "slot-archive";
50
- },
51
- },
52
- });
53
- </script>