Skip to content

Instantly share code, notes, and snippets.

@gearmobile
Created October 24, 2017 07:17
Show Gist options
  • Save gearmobile/d957d3c79df13bcdb9482cbc0fae9615 to your computer and use it in GitHub Desktop.
Save gearmobile/d957d3c79df13bcdb9482cbc0fae9615 to your computer and use it in GitHub Desktop.
Vue.js Props with validation and default value via return function
props: {
value: {
type: Number,
default () { return 2 }
},
min: {
type: Number,
default () { return 1 }
},
max: {
type: Number,
default () { return 10 }
}
}
<input type="range" v-model="value" :min="min" :max="max">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment