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

Commit

Permalink
refactor(linear-progress): Use open prop for showing and hiding linear
Browse files Browse the repository at this point in the history
progress

BREAKING CHANGES: Public component methods for open / close no longer exist.
Please change your templates to use v-model instead.
  • Loading branch information
matsp committed Apr 17, 2018
1 parent 25ca33b commit 1db78b1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 47 deletions.
14 changes: 3 additions & 11 deletions components/linear-progress/LinearProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export default {
props: {
open: {
type: Boolean,
required: false
default: false
},
indeterminate: {
type: Boolean,
required: false
default: false
},
reverse: {
type: Boolean,
required: false
default: false
},
progress: {
type: Number,
Expand Down Expand Up @@ -76,14 +76,6 @@ export default {
},
beforeDestroy () {
this.mdcLinearProgress.destroy()
},
methods: {
show () {
this.mdcLinearProgress.open()
},
hide () {
this.mdcLinearProgress.close()
}
}
}
</script>
28 changes: 15 additions & 13 deletions components/linear-progress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
### Markup

```html
<m-linear-progress ref="progress" open :progress="0.5" :buffer="0.5" indeterminate />
<m-linear-progress
:open="isProgressOpen"
:progress="0.5"
:buffer="0.5"
indeterminate/>
```

### Script

```javascript
this.$refs.progress.show()
this.$refs.progress.hide()
data () {
return {
isProgressOpen: true
}
}
```

### Props & methods
### Props

| Prop | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| open | Boolean | - | false | initial state |
| indeterminate | Boolean | - | false | indeterminate state |
| reverse | Boolean | - | false | reverse direction of progress |
| open | Boolean | false | - | linear progress starts in open state |
| indeterminate | Boolean | false | - | indeterminate state |
| reverse | Boolean | false | - | reverse direction of progress |
| progress | Number | - | false | progress value between 0 and 1 |
| buffer | Number | - | false | buffer value between 0 and 1 |

| Method | Description |
|--------|-------------|
| show | show the progress |
| hide | hide the progress |

### Reference

- https://github.com/material-components/material-components-web/tree/master/packages/mdc-linear-progress
- https://github.com/material-components/material-components-web/tree/master/packages/mdc-linear-progress
28 changes: 5 additions & 23 deletions demo/views/LinearProgressView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,17 @@
<m-layout-grid-inner>
<m-layout-grid-cell :span="4">
<m-linear-progress
ref="progress"
open
:open="isProgressOpen"
:progress="0.5"
:buffer="0.5"
indeterminate/>
</m-layout-grid-cell>
<m-layout-grid-cell :span="8"/>
<m-layout-grid-cell :span="1">
<m-button
@click="stopProgress"
@click="isProgressOpen = !isProgressOpen"
raised
interactive>
hide
</m-button>
</m-layout-grid-cell>
<m-layout-grid-cell :span="1">
<m-button
@click="startProgress"
stroked>
show
</m-button>
interactive>toggle</m-button>
</m-layout-grid-cell>
</m-layout-grid-inner>
</m-layout-grid-cell>
Expand All @@ -43,17 +33,9 @@ Vue.use(LinearProgress)
export default {
data () {
return {
isProgressOpen: true
}
},
methods: {
stopProgress () {
this.$refs.progress.hide()
},
startProgress () {
this.$refs.progress.show()
}
}
}
}}
</script>

<style lang="scss">
Expand Down

0 comments on commit 1db78b1

Please sign in to comment.