Skip to content

Commit

Permalink
fix(SvgIcon): 不解构使用props,避免数据失去reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
yulimchen committed Feb 24, 2021
1 parent b1a71d7 commit c6f3f07
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/SvgIcon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@ export default {
}
},
setup(props) {
const { iconClass, className } = props
const isExternalIcon = computed(() => isExternal(iconClass))
const iconName = computed(() => `#icon-${iconClass}`)
const isExternalIcon = computed(() => isExternal(props.iconClass))
const iconName = computed(() => `#icon-${props.iconClass}`)
const svgClass = computed(() => {
if (className) {
return 'svg-icon ' + className
if (props.className) {
return 'svg-icon ' + props.className
} else {
return 'svg-icon'
}
})
const styleExternalIcon = computed(() => {
return {
mask: `url(${iconClass}) no-repeat 50% 50%`,
'-webkit-mask': `url(${iconClass}) no-repeat 50% 50%`
mask: `url(${props.iconClass}) no-repeat 50% 50%`,
'-webkit-mask': `url(${props.iconClass}) no-repeat 50% 50%`
}
})
Expand Down

0 comments on commit c6f3f07

Please sign in to comment.