Skip to content

Model .number modifier fails to cast selected value of select element. #4018

@gskema

Description

@gskema

Vue.js version

2.0.3

Reproduction Link

https://jsfiddle.net/e4mxqbfv/1/

Steps to reproduce

Change the selected option an look at the output in <pre> element below.

What is Expected?

Selected number type should be a Number because <select> element is bound to a variable (model) and has .number modifier: <select v-model.number="perpage">.

What is actually happening?

Vue fails to cast the selected value to Number, it remains a String.

Workarounds

Some people have suggested binding the value <option :value="10">10</option>, but that's a workaround, not a fix. It's be great if the modifier worked on <select> too or at least there would be a notice in the documentation.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions