Skip to content

Commit

Permalink
fix(select): refactor label foundation as per MDCWeb 0.31.0
Browse files Browse the repository at this point in the history
closes #274
  • Loading branch information
stasson committed Feb 24, 2018
1 parent f9651db commit 0db8ad6
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions components/select/mdc-menu-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<script>
import { mdcMenu } from '../menu'
import MDCSelectFoundation from '@material/select/foundation'
import MDCSelectLabelFoundation from '@material/select/label/foundation'
export default {
name: 'mdc-menu-select',
Expand Down Expand Up @@ -84,15 +85,22 @@ export default {
},
},
mounted () {
this.labelFoundation = new MDCSelectLabelFoundation({
addClass: (className) =>
this.$set(this.labelClasses, className, true),
removeClass: (className) =>
this.$delete(this.labelClasses, className),
})
this.foundation = new MDCSelectFoundation({
addClass: (className) =>
this.$set(this.classes, className, true),
removeClass: (className) =>
this.$delete(this.classes, className),
addClassToLabel: (className) =>
this.$set(this.labelClasses, className, true),
removeClassFromLabel: (className) =>
this.$delete(this.labelClasses, className),
floatLabel: (value) => {
this.labelFoundation.styleFloat(value)
},
addClassToBottomLine: (className) =>
this.$set(this.bottomLineClasses, className, true),
removeClassFromBottomLine: (className) =>
Expand Down Expand Up @@ -206,7 +214,7 @@ export default {
foundation.adapter_.setStyle('width', `${maxTextLength}px`);
}
///
this.labelFoundation.init()
this.foundation.init()
this.foundation.setDisabled(this.disabled)
this.refreshIndex ()
Expand All @@ -218,6 +226,10 @@ export default {
let foundation = this.foundation
this.foundation = null
foundation.destroy()
let foundationLabel = this.foundationLabel
this.foundationLabel = null
foundationLabel.destroy()
}
}
</script>

0 comments on commit 0db8ad6

Please sign in to comment.