Skip to content

Commit

Permalink
fix(badge): optimize code and hide icon when dot prop is true
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed May 1, 2021
1 parent e2687f8 commit 7246fd3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/varlet-ui/src/badge/Badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:class="contentClass"
:style="{ background: color }"
>
<var-icon v-if="icon" :name="icon" size="10px" />
<var-icon v-if="icon && !dot" :name="icon" size="10px" />
<span v-else>{{ values }}</span>
</span>
</transition>
Expand Down Expand Up @@ -51,16 +51,12 @@ export default defineComponent({
return value
})
const getPositionClass = (): string => {
const getPositionClass = (): string | undefined => {
const { position, dot } = props
if (!position || !dot) return ''
if (dot && position.includes('right')) return 'var-badge__dot--right'
if (position.includes('right')) return 'var-badge__dot--right'
if (position.includes('left')) return 'var-badge__dot--left'
return ''
if (dot && position.includes('left')) return 'var-badge__dot--left'
}
return {
Expand Down

0 comments on commit 7246fd3

Please sign in to comment.