Skip to content

Commit

Permalink
fix: add empty check for accessor value
Browse files Browse the repository at this point in the history
  • Loading branch information
chilingling committed Jan 7, 2025
1 parent efd8805 commit d17120d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -379,17 +379,17 @@ export const handleTinyIconPropsHook = (schemaData, globalHooks, config) => {

// 生成 watchEffect
const genStateAccessor = (value, globalHooks) => {
if (isSetter(value?.accessor)) {
if (isSetter(value?.accessor) && value.accessor.setter?.value) {
globalHooks.addStatement({
position: INSERT_POSITION.AFTER_METHODS,
value: `vue.watchEffect(wrap(${value.accessor.setter?.value ?? ''}))`
value: `vue.watchEffect(wrap(${value.accessor.setter?.value}))`
})
}

if (isGetter(value?.accessor)) {
if (isGetter(value?.accessor) && value.accessor.getter?.value) {
globalHooks.addStatement({
position: INSERT_POSITION.AFTER_METHODS,
value: `vue.watchEffect(wrap(${value.accessor.getter?.value ?? ''}))`
value: `vue.watchEffect(wrap(${value.accessor.getter?.value}))`
})
}
}
Expand Down

0 comments on commit d17120d

Please sign in to comment.