1

I am tying to set a default value for a select in Vue.

<script src="https://unpkg.com/vue"></script>

<div id="app">
  <select v:model="select">
       <option value="1">1</option>
       <option value="2">2</option>
       <option value="3">3</option>
  </select>
</div>

<script>
    new Vue({
      el: '#app',
      data: {
        select: '2'
      }
    })
<script>

I would expect the default value to be 2, but it is 1 ?

Here is a fiddle - https://jsfiddle.net/dqgsbw9o/

1 Answer 1

2

Your code is correct except for v:model. That should be v-model:

<select v-model="select">

updated fiddle

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.