T
T
TheRelow2021-11-11 14:31:05
Vue.js
TheRelow, 2021-11-11 14:31:05

How to condition an attribute in vue?

I can add a condition for a normal attribute that doesn't need to be sent to . But if I need to pass something to that attribute, I can't do it.
<input :required="cojndition">

<b-field label="Error" type="is-danger">
      <b-input placeholder="Error"></b-input>
    </b-field>

I need to put a condition on type

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2021-11-11
@TheRelow

:type="condition ? 'is-danger' : undefined" well, or better to take out the computed property.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question