element 取select中的值的对象

2020-04-24  本文已影响0人  回忆不死我们不散
<template>
  <div class="hello">
    <el-form>
       <el-select v-model="value00" placeholder="请选择省" size="small" value-key="value">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item" ></el-option>
        </el-select>
      <el-button @click="handleSubmit">提交</el-button>
    </el-form>
  </div>
</template>

<script>
export default {
  data () {
    return {
      options: [{
          value: '选项1',
          label: '黄金糕'
        }, {
          value: '选项2',
          label: '双皮奶'
        }, {
          value: '选项3',
          label: '蚵仔煎'
        }, {
          value: '选项4',
          label: '龙须面'
        }, {
          value: '选项5',
          label: '北京烤鸭'
        }],
        value00: {
          value: '选项1',
          label: '黄金糕'
        }
    }
  },
  mounted () {
  },
  methods: {
    handleSubmit () {
      console.log(this.value00)
    }
  }
}
</script>

<style scoped>
</style>

转载自:https://www.jianshu.com/p/be77c800d16c

上一篇下一篇

猜你喜欢

热点阅读