fix: compatible with {} in template literals

This commit is contained in:
LeoYuan 袁力皓 2023-03-30 16:41:43 +08:00 committed by 刘菊萍(絮黎)
parent 122f0b30a0
commit 48bc8d7659
68 changed files with 85 additions and 84 deletions

View File

@ -23,9 +23,9 @@ sidebar_position: 1
## 如何使用
### 1) 通过命令行快速体验
欢迎使用命令行工具快速体验:`npx @alilc/lowcode-code-generator -i example-schema.json -o generated -s icejs`
欢迎使用命令行工具快速体验:`npx @alilc/lowcode-code-generator -i example-schema.json -o generated -s icejs3`
--其中 example-schema.json 可以从[这里下载](https://unpkg.com/@alilc/lowcode-code-generator@beta/example-schema.json)
--其中 example-schema.json 可以从[这里下载](https://alifd.alicdn.com/npm/@alilc/lowcode-code-generator@latest/example-schema.json)
### 2) 通过设计器插件快速体验
@ -112,7 +112,7 @@ await CodeGenerator.init();
```javascript
const result = await CodeGenerator.generateCode({
solution: 'icejs', // 出码方案 (目前内置有 icejs 和 rax )
solution: 'icejs', // 出码方案 (目前内置有 icejs、icejs3 和 rax )
schema, // 编排搭建出来的 schema
});
@ -124,6 +124,7 @@ console.log(result); // 出码结果 (默认是递归结构描述的,可以传
### 5自定义出码
前端框架灵活多变,默认内置的出码方案很难满足所有人的需求,好在此代码生成器支持非常灵活的插件机制 -- 内置功能大多都是通过插件完成的(在 `src/plugins`下),比如:
![image.png](https://img.alicdn.com/imgextra/i1/O1CN01CEl2Hq1omnH0UCyGF_!!6000000005268-2-tps-457-376.png)
所以您可以通过添加自己的插件或替换掉默认内置的插件来实现您的自定义功能。
为了方便自定义出码方案,出码模块还提供自定义出码方案的脚手架功能,即执行下面脚本即可生成一个自定义出码方案:
```shell

View File

@ -1370,11 +1370,11 @@ export const recordEvent = function(logkey, gmkey, gokey, reqMethod) {
"i18n": {
"zh-CN": {
"i18n-hello": "你好",
"i18n-chicken": "我有${count}只鸡"
"i18n-chicken": "我有{count}只鸡"
},
"en-US": {
"i18n-hello": "Hello",
"i18n-chicken": "I have ${count} chicken"
"i18n-chicken": "I have {count} chicken"
}
}
}

View File

@ -72,7 +72,7 @@
"lifeCycles": {
"componentDidMount": {
"type": "JSFunction",
"value": "function() { console.log('componentDidMount'); }"
"value": "function componentDidMount() { console.log('componentDidMount'); }"
}
},
"dataSource": {

View File

@ -72,7 +72,7 @@
lifeCycles: {
componentDidMount: {
type: 'JSFunction',
value: "function() { console.log('componentDidMount'); }",
value: "function componentDidMount() { console.log('componentDidMount'); }",
},
},
dataSource: {

View File

@ -103,7 +103,7 @@ export default defineConfig(() => ({
importStyle: 'sass',
themePackage: '${getThemeInfo(cfg.themePackage).name}',
}` : `{
importStyle: true,
importStyle: 'sass',
}`}),
locales(),
plugin(),

View File

@ -10,13 +10,13 @@ export default function getFile(): [string[], ResultFile] {
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -41,7 +41,7 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) => (
typeof msg === 'string'
? msg.replace(/\\\$\\{(\\w+)\\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\\\$?\\{(\\w+)\\}/g, (match, key) => variables?.[key] ?? '')
: msg
);

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -28,7 +28,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -28,7 +28,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -81,7 +81,7 @@ export default defineConfig(() => ({
},
plugins: [
fusion({
importStyle: true,
importStyle: 'sass',
}),
locales(),
plugin(),

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -3,13 +3,13 @@
display: flex;
align-items: center;
justify-content: center;
color: $color-text1-1;
color: #FF7300;
font-weight: bold;
font-size: 14px;
line-height: 22px;
&:visited, &:link {
color: $color-text1-1;
color: #FF7300;
}
img {

View File

@ -14,7 +14,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -14,7 +14,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -14,7 +14,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -14,7 +14,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -21,7 +21,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -21,7 +21,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -21,7 +21,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -21,7 +21,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -21,7 +21,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -21,7 +21,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -14,7 +14,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -21,7 +21,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -14,7 +14,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string' ? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
typeof msg === 'string' ? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '') : msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg = i18nConfig[locale]?.[id] ?? i18nConfig[locale.replace('-', '_')]?.[id] ?? defaultMessage;

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -28,7 +28,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -28,7 +28,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {

View File

@ -19,7 +19,7 @@ const isEmptyVariables = (variables) =>
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
? msg.replace(/\$?\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {