Skip to content

Commit

Permalink
refactor(icon): reduce getter access (#9360)
Browse files Browse the repository at this point in the history
* Update icon.vue

* Update icon.vue
  • Loading branch information
zhangenming committed Aug 30, 2022
1 parent 954b840 commit d4d411c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/components/icon/src/icon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ const props = defineProps(iconProps)
const ns = useNamespace('icon')
const style = computed<CSSProperties>(() => {
if (!props.size && !props.color) return {}
const { size, color } = props
if (!size && !color) return {}
return {
fontSize: isUndefined(props.size) ? undefined : addUnit(props.size),
'--color': props.color,
fontSize: isUndefined(size) ? undefined : addUnit(size),
'--color': color,
}
})
</script>

0 comments on commit d4d411c

Please sign in to comment.