elemeng-ui中el-select的默认选择项问题


直接绑定将option中的value值绑定给v-model

<template>
  <div>
    <el-select v-model="query">
      <el-option v-for="item in options" :key="item.value" :value="item.value" :label="item.label"></el-option>
    </el-select>
  </div>
</template>
<script>
export default{
  data() {
    return {
      options: [{
        value: '01',
        label: '我的'
      }, {
 value: '02', label: '你的'
      }, {
        value: '03',
        label: '他的'
      }],
    query: '02'
    }
  }
}
</script>
<style></style>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM