fix: schemaSettingsTemplate

This commit is contained in:
katherinehhh 2024-02-04 10:23:03 +08:00
parent 04e0a4db50
commit 438cef09e9

View File

@ -236,7 +236,7 @@ export const SchemaSettingsTemplate = function Template(props) {
title="Save as template"
onClick={async () => {
setVisible(false);
const { title } = collectionName ? getCollection(collectionName) : { title: '' };
const collection = collectionName && getCollection(collectionName);
const values = await FormDialog(
t('Save as template'),
() => {
@ -250,7 +250,9 @@ export const SchemaSettingsTemplate = function Template(props) {
name: {
title: t('Template name'),
required: true,
default: title ? `${compile(title)}_${t(componentName)}` : t(componentName),
default: collection
? `${compile(collection?.title || collection?.name)}_${t(componentName)}`
: t(componentName),
'x-decorator': 'FormItem',
'x-component': 'Input',
},