leisure-core 0.5.36 → 0.5.38
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.
- package/le-list/src/main.vue +1 -0
- package/le-list-form/src/main.vue +26 -11
- package/package.json +1 -1
package/le-list/src/main.vue
CHANGED
|
@@ -103,6 +103,10 @@ export default {
|
|
|
103
103
|
type: String,
|
|
104
104
|
default: "16px",
|
|
105
105
|
},
|
|
106
|
+
externalComponentMap: {
|
|
107
|
+
type: Object,
|
|
108
|
+
default: () => ({}),
|
|
109
|
+
},
|
|
106
110
|
},
|
|
107
111
|
watch: {
|
|
108
112
|
formData: {
|
|
@@ -125,7 +129,13 @@ export default {
|
|
|
125
129
|
},
|
|
126
130
|
data() {
|
|
127
131
|
return {
|
|
128
|
-
|
|
132
|
+
formPop: {},
|
|
133
|
+
options: {}, //{field1:[{value:1,label:'选项1'},{value:2,label:'选项2'}]}
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
computed: {
|
|
137
|
+
dynamicComponentMap() {
|
|
138
|
+
const baseMap = {
|
|
129
139
|
input: {
|
|
130
140
|
component: "le-input",
|
|
131
141
|
props: { placeholder: "请输入" },
|
|
@@ -154,12 +164,9 @@ export default {
|
|
|
154
164
|
component: "le-area",
|
|
155
165
|
props: {},
|
|
156
166
|
},
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
};
|
|
161
|
-
},
|
|
162
|
-
computed: {
|
|
167
|
+
};
|
|
168
|
+
return { ...baseMap, ...this.externalComponentMap };
|
|
169
|
+
},
|
|
163
170
|
gridStyle() {
|
|
164
171
|
return {
|
|
165
172
|
"grid-template-columns": `repeat(${this.columnsPerRow}, 1fr)`,
|
|
@@ -171,19 +178,27 @@ export default {
|
|
|
171
178
|
mounted() {},
|
|
172
179
|
methods: {
|
|
173
180
|
componentType(type) {
|
|
174
|
-
|
|
175
|
-
|
|
181
|
+
if (!this.dynamicComponentMap[type]) {
|
|
182
|
+
return "le-input";
|
|
183
|
+
}
|
|
184
|
+
return this.dynamicComponentMap[type]?.component || "le-input";
|
|
176
185
|
},
|
|
177
186
|
getComponentProps(item) {
|
|
178
187
|
let type = item.type;
|
|
179
|
-
|
|
188
|
+
|
|
189
|
+
// 如果组件类型未定义,返回空对象
|
|
190
|
+
if (!this.dynamicComponentMap[type]) {
|
|
191
|
+
return {};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
let props = this.dynamicComponentMap[type]?.props || {};
|
|
180
195
|
if (type === "image") {
|
|
181
196
|
let images = [];
|
|
182
197
|
images.push(this.formPop[item.prop]);
|
|
183
198
|
props = { ...props, images: images };
|
|
184
199
|
return props;
|
|
185
200
|
}
|
|
186
|
-
return this.
|
|
201
|
+
return this.dynamicComponentMap[item.type]?.props || {};
|
|
187
202
|
},
|
|
188
203
|
mergeProps(defaultProps, customProps) {
|
|
189
204
|
return { ...defaultProps, ...customProps };
|