I use vuetifyjs for my html & css. One of it's components changes it's styling/behavior based on a custom directive (error || success || warning || info)
e.g.
<v-snackbar error></v-snackbar>
<v-snackbar success></v-snackbar>
Is there a way to bind the directive to a data or computed value?
something like this:
<v-snackbar {{ type }}></v-snackbar>
Create a data property called
type
(or whatever you want to call it) that has the properties that you want to pass (say,success
).And bind it to the
snackbar
component.Here is a modified example from their documentation. In the example, click the Set Error or Set Success buttons to change the type.