Skip to content

Commit

Permalink
fix: code check (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoyun8 committed Nov 30, 2023
1 parent 8ed61ca commit a8379f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/utils/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -297,7 +298,7 @@ function _deepClone(target, map) {
return target
}

let res = naiveDeepClone(copyTarget)
let res = nativeDeepClone(copyTarget)

if (res) {
map.set(target, res)
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-generator/src/generator/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a8379f2

Please sign in to comment.