Skip to content

Deprecate "options" param for <select v-model> #1229

@yyx990803

Description

@yyx990803

Problem

The options param has been a common gotcha when dealing with v-model on <select> elements. It often requires additional formatting of the source data with a custom filter, and has limited capabilities in customizing the rendered options.

Proposal

The reason options existed was due to some internal implementation issues - there is really no reason for it to be that way from the UX perspective. Therefore in 1.0, with some internal refactoring, we will deprecate the options param - instead, just use a normal v-for:

<select v-model="selected">
  <option v-for="option in list">{{option}}</option>
</select>

If you have an Array of objects, you can also bind the underlying v-model value directly to the object by using v-bind:value on the options:

<select v-model="selected">
  <option v-for="obj in objList" v-bind:value="obj">{{obj.description}}</option>
</select>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions