1.组件change添加参数,添加支持function格式2.多选框bug修复
This commit is contained in:
@ -192,7 +192,7 @@
|
||||
}
|
||||
|
||||
function displayText() {
|
||||
const _checked = checked.value;;
|
||||
const _checked = checked.value || [];
|
||||
const labelArr = [];
|
||||
(getOptions.value || []).forEach((opt) => {
|
||||
if (_checked.includes(opt.value)) {
|
||||
|
||||
@ -438,9 +438,14 @@
|
||||
if (schema.componentProps?.['events']) {
|
||||
for (const eventKey in schema.componentProps['events']) {
|
||||
if (eventKey !== 'change') return;
|
||||
const handler = schema.componentProps['events'][eventKey];
|
||||
try {
|
||||
const event = new Function('schema', 'formModel', 'formActionType', 'extParams', `${schema.componentProps['events'][eventKey]}`);
|
||||
event(schema, formModel, formApi, { formData });
|
||||
if (typeof handler === 'string') {
|
||||
const event = new Function('schema', 'formModel', 'formActionType', 'extParams', handler);
|
||||
event(schema, formModel, formApi, { formData, allSchemas });
|
||||
} else if (typeof handler === 'function') {
|
||||
handler(schema, formModel, formApi, { formData, allSchemas });
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('error', error);
|
||||
notification.error({
|
||||
|
||||
@ -438,9 +438,14 @@
|
||||
if (schema.componentProps?.['events']) {
|
||||
for (const eventKey in schema.componentProps['events']) {
|
||||
if (eventKey !== 'change') return;
|
||||
const handler = schema.componentProps['events'][eventKey];
|
||||
try {
|
||||
const event = new Function('schema', 'formModel', 'formActionType', 'extParams', `${schema.componentProps['events'][eventKey]}`);
|
||||
event(schema, formModel, formApi, { formData });
|
||||
if (typeof handler === 'string') {
|
||||
const event = new Function('schema', 'formModel', 'formActionType', 'extParams', handler);
|
||||
event(schema, formModel, formApi, { formData, allSchemas });
|
||||
} else if (typeof handler === 'function') {
|
||||
handler(schema, formModel, formApi, { formData, allSchemas });
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('error', error);
|
||||
notification.error({
|
||||
|
||||
@ -275,6 +275,7 @@
|
||||
}) ?? {};
|
||||
} else {
|
||||
if (componentProps['events']) {
|
||||
const allSchemas = formProps.value.schemas;
|
||||
for (const eventKey in componentProps['events']) {
|
||||
try {
|
||||
const fun = componentProps['events'][eventKey];
|
||||
@ -290,7 +291,7 @@
|
||||
let field = camelCaseString(item);
|
||||
if (field) cloneFormModel[field] = cloneFormModel[item];
|
||||
}
|
||||
event(props.schema, isCamelCase ? cloneFormModel : formModel, props.formApi, { value, selectedOptions });
|
||||
event(props.schema, isCamelCase ? cloneFormModel : formModel, props.formApi, {formData, value, selectedOptions, allSchemas: allSchemas});
|
||||
|
||||
if (isCamelCase) {
|
||||
for (let item in formModel) {
|
||||
|
||||
Reference in New Issue
Block a user