Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
fix(fab): Set ripple on class changes
Browse files Browse the repository at this point in the history
BREAKING CHANGES: Removed interactive prop, ripple effect is now default.
  • Loading branch information
matsp committed May 17, 2018
1 parent ffca1ab commit f049ab3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
19 changes: 10 additions & 9 deletions components/fab/Fab.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<button
class="mdc-fab"
:class="classes"
class="mdc-fab"
v-on="$listeners">
<slot />
</button>
Expand All @@ -26,10 +26,6 @@ export default {
exited: {
type: Boolean,
default: false
},
interactive: {
type: Boolean,
default: false
}
},
data () {
Expand All @@ -47,23 +43,28 @@ export default {
}
}
},
watch: {
classes () {
this.mdcRipple.destroy()
this.mdcRipple = MDCRipple.attachTo(this.$el)
}
},
mounted () {
this.updateSlot()
this.slotObserver = new MutationObserver( () => this.updateSlot())
this.slotObserver = new MutationObserver(() => this.updateSlot())
this.slotObserver.observe(this.$el, {
childList: true,
subtree: true
})
if (this.interactive) { this.mdcRipple = MDCRipple.attachTo(this.$el) }
this.mdcRipple = MDCRipple.attachTo(this.$el)
},
beforeDestroy () {
this.slotObserver.disconnect()
if (typeof this.mdcRipple !== 'undefined') {
this.mdcRipple.destroy()
}
},
methods: {
methods: {
updateSlot () {
if (this.$slots.default) {
this.$slots.default.map(n => {
Expand Down
1 change: 0 additions & 1 deletion components/fab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
| mini | Boolean | false | mini fab button |
| absoluteRight | Boolean | false | whether the fab should be rendered on the bottom right |
| exited | Boolean | false | animates the fab out of view |
| interactive | Boolean | false | fab with ripple effect |

Events are mapped to the inner button element.

Expand Down

0 comments on commit f049ab3

Please sign in to comment.