0

The default option ('Choose Default Meta Data') is not rendering but selected as view, anyone can help?

<div class="input-field col s12">
  <select id="custom-select-f" v-model="meta_id" class="browser-default">
    <option value="" disabled :selected="meta_id ? false : true">Choose Default Meta Data</option>
    <option value="">Set As None</option>
    <option v-for="meta in metas" :value="meta.id">{{meta.data}}</option>
  </select>
  <label for="custom-select-f" class="active">Meta Data</label>
</div>

1
  • You can't have a disabled option selected. Commented Jun 26, 2017 at 7:00

1 Answer 1

1

Instead of binding to the selected attribute, I gave the option a 'fake' value: https://jsfiddle.net/DarkFruits/5mk2hrfn/

<select name="" id="select" v-model='name'>
  <option value="none" disabled >None</option>
  <option value="max" >Max</option>
  <option value="alex" >alex</option>
  <option v-for='n in names' :value="n">{{n}}</option>
</select>

new Vue({
    el: '#select',
    data() {
    return {
      names: ['Sandy', 'Pete'],
        name: 'none',
    }
  }
})
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.