fix: title translate

This commit is contained in:
gchust 2025-06-30 21:15:25 +08:00
parent 582107f0c6
commit a37828c3cd
3 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ export class DataBlockModel<T = DefaultStructure> extends BlockModel<T> {
get title() { get title() {
return ( return (
this._title || this.translate(this._title) ||
` `
${this.collection.title} > ${this.collection.title} >
${this.collection.dataSource.displayName} > ${this.collection.dataSource.displayName} >

View File

@ -912,8 +912,8 @@ describe('FlowModel', () => {
describe('subModels serialization', () => { describe('subModels serialization', () => {
test('should serialize subModels in model data', () => { test('should serialize subModels in model data', () => {
const child1 = new FlowModel({ uid: 'child1', flowEngine, props: { name: 'first' } }); const child1 = new FlowModel({ uid: 'child1', flowEngine });
const child2 = new FlowModel({ uid: 'child2', flowEngine, props: { name: 'second' } }); const child2 = new FlowModel({ uid: 'child2', flowEngine });
parentModel.setSubModel('singleChild', child1); parentModel.setSubModel('singleChild', child1);
parentModel.addSubModel('multipleChildren', child2); parentModel.addSubModel('multipleChildren', child2);

View File

@ -138,7 +138,7 @@ export class FlowModel<Structure extends DefaultStructure = DefaultStructure> {
get title() { get title() {
// model 可以通过 setTitle 来自定义title 具有更高的优先级 // model 可以通过 setTitle 来自定义title 具有更高的优先级
return this._title || this.translate(this.constructor['meta']?.title); return this.translate(this._title) || this.translate(this.constructor['meta']?.title);
} }
setTitle(value: string) { setTitle(value: string) {