Skip to content

Commit

Permalink
fix: 兼容未覆盖的场景 #298
Browse files Browse the repository at this point in the history
  • Loading branch information
yolofit committed Apr 24, 2021
1 parent da40821 commit ea1337f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/text-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,25 @@ export default {
border: 'none',
background: 'inherit',
padding: '9px 0',
color: ''
color: '',
pointerEvents: ''
}
}
},
watch: {
'$attrs.disabled': 'fixHoverColor'
},
mounted() {
this.fixHoverColor()
this.style.color = getComputedStyle(this.$el).color
},
methods: {
// 将 color 写到 style 里是为了覆盖 hover 效果
fixHoverColor() {
async fixHoverColor() {
this.style.color = ''
this.style.pointerEvents = 'none'
await new Promise(r => setTimeout(r, 300))
this.style.color = getComputedStyle(this.$el).color
this.style.pointerEvents = ''
}
}
}
Expand Down

0 comments on commit ea1337f

Please sign in to comment.