Can someone explain to me exactly what the input-value
attribute does on the v-switch component?
I think it has something to due with using the component with vuex, when you cannot use v-model directly.
It seems to be working for me, but I don't understand it exactly.
You can see the attribute here: https://vuetifyjs.com/en/components/selection-controls#api
Where it is described as: "The v-model bound value".
(I originally found the attribute in an example somehere.)
There are 2 primary layout components in Vuetify, v-app and v-main . The v-app component is the root of your application and a direct replacement for the default Vue entrypoint, <div id="app"> . The v-main component is a semantic replacement for the main HTML element and the root of your application's content.
Simply include the Vuetify css file in your index. html or import the actual stylus file or the minified css. Some components like the date picker use Material Icons. The easiest way to include them is to add a link tag to your index.
The current version of Vuetify does not support Vue 3.
v-text works by setting the element's textContent property, so it will overwrite any existing content inside the element. If you need to update the part of textContent , you should use mustache interpolations instead. Example.
input-value
behaves like a default value
attribute that you would expect in other components.
Normally v-model
is syntax sugar for :value="value" :input="$emit('input', $event.target.value)"
, but we can change it.
from selectable.js:
model: {
prop: 'inputValue',
event: 'change'
},
So the above lines (see vue docs) make your v-model
bind to input-value
instead of value
likely because some components i.e. checkbox (which v-switch uses) have value
attribute reserved for something else.
So value
attribute is then used to set the value which will be represented when the component is checked.
And in v-switch
case v-model
is syntax sugar for something like :input-value="value" @change="value = $event"
Codepen
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With