2

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>
2

1 Answer 1

1

Create a data property called type (or whatever you want to call it) that has the properties that you want to pass (say, success).

data:{
  type: {success: true}
}

And bind it to the snackbar component.

<v-snackbar v-bind="type"></v-snackbar>

Here is a modified example from their documentation. In the example, click the Set Error or Set Success buttons to change the type.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.