vue下拉选择

<template>
<div class="input">
    <select v-model="fruit" >
        <option v-for="option in options" v-bind:value="option.value">
            {{ option.text }}
        </option>
    </select>
    <span>Selected:{{ fruit }}</span>
</div>
</template>
<script>
export default {
    data () {
        return {
            fruit: 'apple',
            options: [{
                text: '苹果',
                value: 'apple'
            }, {
                text: '香蕉',
                value: 'banana'
            }, {
                text: '西瓜',
                value: 'watermelon'
            }]
        }
    }
}
</script>

图片描述

为啥效果出不来

阅读 5.1k
3 个回答

找到原因了,vue不支持select属性,要使用picker内建模块

我在自己本地测了一下,是可以的

clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题