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

IOS10 Safari浏览器中select唤起后,点击完成无法选择当前项目。 #6581

Closed
larryspace opened this issue Sep 12, 2017 · 2 comments

Comments

@larryspace
Copy link

larryspace commented Sep 12, 2017

Version

2.4.2

Reproduction link

https://jsfiddle.net/smpd16g0/

Steps to reproduce

<select v-model="value">
        <option v-for="item in options" :value="item.value">{{item.name}}</option>
</select>
{
    value: null,
    options: [
        {name: '男', value: 1},
        {name: '女', value: 2},
        {name: '其他', value: 3}
    ]
}

在IOS Safari中点击下拉框,此时默认会选中第一个,随后点击完成按钮,select框没有选择任何数据。

What is expected?

点击完成按钮后,第一项会选中。

What is actually happening?

点击完成按钮后,未选择任何数据。必须滑动到其他选项再回到第一项才能选中。

@fritx
Copy link

fritx commented Sep 12, 2017

Just met the same thing today!

My workaround was:

<select v-model="value">
  <option v-for="item in options" :value="item.value" :disabled="item.disabled">
    {{item.name}}
  </option>
</select>
options.unshift({ name: '请选择', value: '', disabled: true })
// options.unshift({ name: 'pick one', value: '', disabled: true })

@vuejs vuejs deleted a comment from biomassives Sep 12, 2017
@yyx990803
Copy link
Member

This is a iOS system issue and we can't do much in Vue core. You have 2 workarounds:

  1. Add a hidden optgroup before options: <optgroup hidden="true" disabled></optgroup>

  2. Make sure to initialize the select with a default value that has a matching option.

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

No branches or pull requests

3 participants