mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
fix: title translate
This commit is contained in:
parent
582107f0c6
commit
a37828c3cd
@ -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} >
|
||||||
|
@ -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);
|
||||||
|
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user