|
@ -1,8 +1,8 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div> |
|
|
<div> |
|
|
<q-form ref="formRef" :autofocus="false" :greedy="true" v-bind="attrs"> |
|
|
<q-form ref="formRef" :autofocus="false" :greedy="true" v-bind="attrs"> |
|
|
<div v-if="fieldsComputed.value.length > 0" class="grid" :class="formLayoutComputed"> |
|
|
<div v-if="fieldsComputed.length > 0" class="grid" :class="formLayoutComputed"> |
|
|
<template v-for="(field, index) in fieldsComputed.value as any" :key="String(index)"> |
|
|
<template v-for="(field, index) in fieldsComputed as any" :key="String(index)"> |
|
|
<component |
|
|
<component |
|
|
:is="fiedType[field.type] || field.type" |
|
|
:is="fiedType[field.type] || field.type" |
|
|
v-if="field.name" |
|
|
v-if="field.name" |
|
@ -131,27 +131,35 @@ watch( |
|
|
}, |
|
|
}, |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// eventBus.on('localeChanged', (local) => { |
|
|
// eventBus.on('onLocaleChanged', (local) => { |
|
|
|
|
|
// console.info('localeChanged====0----'); |
|
|
// nextTick(() => { |
|
|
// nextTick(() => { |
|
|
// console.info('props.fields====', props.fields); |
|
|
// console.info('localeChanged====1----', props.fields); |
|
|
|
|
|
// fields_ = ref([...props.fields]); |
|
|
|
|
|
// for (const field of fields_.value as any) { |
|
|
|
|
|
// if (field.name) { |
|
|
|
|
|
// formFields[field.name] = field; |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// localFlag.value = !localFlag.value; |
|
|
|
|
|
// console.info('localeChanged====2----', fields_.value); |
|
|
// }); |
|
|
// }); |
|
|
// }); |
|
|
// }); |
|
|
|
|
|
watch( |
|
|
const fieldsComputed = computed(() => { |
|
|
() => props.fields.map((item) => item['label']), |
|
|
localFlag.value; |
|
|
(newVal, oldVal) => { |
|
|
return fields_; |
|
|
|
|
|
}); |
|
|
|
|
|
onUpdated(() => { |
|
|
|
|
|
nextTick(() => { |
|
|
|
|
|
localFlag.value = !localFlag.value; |
|
|
|
|
|
fields_ = ref([...props.fields]); |
|
|
fields_ = ref([...props.fields]); |
|
|
for (const field of fields_.value as any) { |
|
|
for (const field of fields_.value as any) { |
|
|
if (field.name) { |
|
|
if (field.name) { |
|
|
formModel[field.name] = defaultValueHandler(field); |
|
|
|
|
|
formFields[field.name] = field; |
|
|
formFields[field.name] = field; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
localFlag.value = !localFlag.value; |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
const fieldsComputed = computed(() => { |
|
|
|
|
|
localFlag.value; |
|
|
|
|
|
return fields_.value; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
for (const field of fields_.value as any) { |
|
|
for (const field of fields_.value as any) { |
|
|