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
|
||||
}
|
||||
|
||||
export function naiveDeepClone(target) {
|
||||
export function nativeDeepClone(target) {
|
||||
try {
|
||||
return structuredClone(target)
|
||||
} catch (error) {
|
||||
// target is no serializable
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,7 +298,7 @@ function _deepClone(target, map) {
|
|||
return target
|
||||
}
|
||||
|
||||
let res = naiveDeepClone(copyTarget)
|
||||
let res = nativeDeepClone(copyTarget)
|
||||
|
||||
if (res) {
|
||||
map.set(target, res)
|
||||
|
|
|
@ -42,9 +42,9 @@ function recurseChildren(children, state, description, result) {
|
|||
} else if (children?.type === 'JSExpression') {
|
||||
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}.`)
|
||||
}
|
||||
})
|
||||
} else if (children?.type === 'i18n') {
|
||||
result.push(`{{ t('${children.key}') }}`)
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue