Skip to content

Vue Selected Bind Does Not Work on Option Tags #8016

@jbenner-radham

Description

@jbenner-radham

Version

2.5.16

Reproduction link

https://codepen.io/jbenner/pen/geJqex

Steps to reproduce

  1. Instantiate a Vue instance with a data property named locations which is an array consisting of ['all', 'north', 'south', 'east', 'west'].
  2. Iterate over the locations in an option tag like so <option v-for="location in locations" :selected="location === 'all'">{{ location }}</option>.

What is expected?

The selected attribute to be set on the "all" option element.

What is actually happening?

The selected attribute is not being set.


I've also tried the following while attempting to debug but to no avail:

<option v-for="(location, index) in locations" :selected="index === 0">{{ location }}</option>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions