mirror of
https://github.com/nocobase/nocobase.git
synced 2026-08-29 02:03:53 +08:00
fix(client): prevent empty display text from crashing field rendering (#8950)
This commit is contained in:
@@ -12,9 +12,9 @@ import React from 'react';
|
||||
import { ClickableFieldModel } from './ClickableFieldModel';
|
||||
|
||||
export class DisplayTextFieldModel extends ClickableFieldModel {
|
||||
t(value: string) {
|
||||
t(value: string | undefined | null) {
|
||||
// 如果 value 是 {{ 开头 }} 结尾,则认为是 i18n 表达式,需要翻译
|
||||
if (value.startsWith('{{') && value.endsWith('}}')) {
|
||||
if (value?.startsWith('{{') && value?.endsWith('}}')) {
|
||||
return this.translate(value);
|
||||
}
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user