1

I have a simple select in vue2:

  <select v-model="formColumns">
    <option value="one_x">1</option>
    <option value="two_x">2</option>
    <option value="three_x">3</option>
  </select>

I'm then trying to apply the value of this, as a class:

I've tried this:

<div v:bind:class="formColumns"></div>

and this:

  <div v:bind:class="{one_x: formColumns === 'one_x'}" ></div>

Neither of these seem to work. I have:

  data () {
    return {
     formColumns: 'one_x'
    }
  }

Any idea what I'm doing wrong here?

Thank you

1 Answer 1

3

Your v-bind directive syntax is not correct

<div v:bind:class="formColumns"></div>

Use this:

<div v-bind:class="formColumns"></div>

or this:

<div :class="formColumns"></div>
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.