fix: create tree collection field (#4321)

This commit is contained in:
katherinehhh 2024-05-12 20:25:28 +08:00 committed by GitHub
parent 5f5d3f3d90
commit 31b410dd69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,7 +76,7 @@ export class TreeCollectionTemplate extends CollectionTemplate {
beforeSubmit(values) {
if (Array.isArray(values?.fields)) {
values?.fields.map((f) => {
if (!f.target) {
if (!f.target && ['belongsToMany', 'belongsTo', 'hasMany', 'hasOne'].includes(f.type)) {
f.target = values.name;
}
});