forked from opentiny/tiny-engine
fix: code check (#112)
This commit is contained in:
parent
8ed61ca311
commit
a8379f2bda
|
@ -251,11 +251,12 @@ function cloneObject(target, map, _deepClone) {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
export function naiveDeepClone(target) {
|
export function nativeDeepClone(target) {
|
||||||
try {
|
try {
|
||||||
return structuredClone(target)
|
return structuredClone(target)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// target is no serializable
|
// target is no serializable
|
||||||
|
return undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +298,7 @@ function _deepClone(target, map) {
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = naiveDeepClone(copyTarget)
|
let res = nativeDeepClone(copyTarget)
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
map.set(target, res)
|
map.set(target, res)
|
||||||
|
|
|
@ -42,9 +42,9 @@ function recurseChildren(children, state, description, result) {
|
||||||
} else if (children?.type === 'JSExpression') {
|
} else if (children?.type === 'JSExpression') {
|
||||||
result.push(`{{ ${children.value.replace(/this\.(props\.)?/g, '')} }}`)
|
result.push(`{{ ${children.value.replace(/this\.(props\.)?/g, '')} }}`)
|
||||||
|
|
||||||
for (const key in description.jsResource) {
|
Object.keys(description.jsResource).forEach((key) => {
|
||||||
description.jsResource[key] = description.jsResource[key] || children.value.includes(`.${key}.`)
|
description.jsResource[key] = description.jsResource[key] || children.value.includes(`.${key}.`)
|
||||||
}
|
})
|
||||||
} else if (children?.type === 'i18n') {
|
} else if (children?.type === 'i18n') {
|
||||||
result.push(`{{ t('${children.key}') }}`)
|
result.push(`{{ t('${children.key}') }}`)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue