Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The <option> value attribute behaves differently #4494

Closed
cnwhy opened this issue Dec 16, 2016 · 3 comments · Fixed by #4505
Closed

The <option> value attribute behaves differently #4494

cnwhy opened this issue Dec 16, 2016 · 3 comments · Fixed by #4505

Comments

@cnwhy
Copy link

cnwhy commented Dec 16, 2016

Vue.js version

2.1.6

Reproduction Link

http://sandbox.runjs.cn/show/g9bqfzhr

Steps to reproduce

<div id="app">
    <select id="s1">
        <option value="111">111</option>
        <option :value="v">{{v}}</option>
        <option :value="v" v-text="v"></option>
        <option :value="v">111</option>
        <option value="111">{{v}}</option>
    </select>
</div>
<script>
new Vue({
    el: "#app",
    data: {
        v: "111"
    }
})
</script>

What is Expected?

<div id="app">
    <select id="s1">
        <option value="111">111</option>
        <option value="111">111</option>
        <option value="111">111</option>
        <option value="111">111</option>
        <option value="111">111</option>
    </select>
</div>

What is actually happening?

<div id="app">
    <select id="s1">
        <option value="111">111</option>
        <option>111</option>
        <option value="111">111</option>
        <option>111</option>
        <option value="111">111</option>
    </select>
</div>
@defcc
Copy link
Member

defcc commented Dec 16, 2016

Maybe we need to force value setting for option? https://github.com/vuejs/vue/blob/dev/src/platforms/web/runtime/modules/dom-props.js#L38

<option>text</option>

For option with emty value, option.value will be the text, which is the same in this issue.

@defcc defcc added the 2.x label Dec 16, 2016
@yyx990803
Copy link
Member

@defcc yeah, just need a special case for 'option'.

@aierui
Copy link

aierui commented Dec 16, 2016

meaningful!

yyx990803 pushed a commit that referenced this issue Dec 21, 2016
* update dom prop for option.value

* refactor value update logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants