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

Commit

Permalink
feat(chips): Synchronise with mdc-web v0.32.0 (add choice and filter)
Browse files Browse the repository at this point in the history
  • Loading branch information
matsp committed Mar 7, 2018
1 parent 1aefd2f commit 224b2e8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
5 changes: 3 additions & 2 deletions components/chips/Chip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ export default {
n.elm.setAttribute('tabindex', '0')
})
}
this.mdcChip = MDCChip.attachTo(this.$el)
// this done by MDCChipSet:
// this.mdcChip = MDCChip.attachTo(this.$el)
}
}
</script>
29 changes: 28 additions & 1 deletion components/chips/ChipSet.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
<template>
<div class="mdc-chip-set" />
<div
class="mdc-chip-set"
:class="classes">
<slot/>
</div>
</template>

<script>
import { MDCChipSet } from '@material/chips'
export default {
props: {
choice: {
type: Boolean,
default: false
},
filter: {
type: Boolean,
default: false
}
},
data () {
return {
mdcChipSet: null
}
},
computed: {
classes () {
return {
'mdc-chip-set--choice': this.choice,
'mdc-chip-set--filter': this.filter
}
}
},
mounted () {
this.mdcChipSet = MDCChipSet.attachTo(this.$el)
},
methods: {
getSelectedChips () {
return this.mdcChipSet.foundation_.selectedChips_
}
}
}
</script>
11 changes: 11 additions & 0 deletions components/chips/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
</m-chip-set>
```

### Props & methods

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| choice | Boolean | false | single selection chips in set |
| filter | Boolean | false | multiple selection chips in set |

| Method | Description |
|--------|-------------|
| getSelectedChips | returns all selected chips of the set as array |

## Chip

### Slots
Expand Down

0 comments on commit 224b2e8

Please sign in to comment.