element-ui select多选情况下获取label和value


<el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm" size="mini">
        <el-form-item label="直播标题:">
          <el-select v-model="ruleForm.title" placeholder="请选择" @change="contentChange($event)">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.title"
              :value="item.title">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>

 2. methods里面定义方法。

contentChange (e) {
      if (this.options) {
        this.options.map( (item) => {
          if (item.title == this.ruleForm.title) {
            this.ruleForm.content = item.content;
          }
        })
      }
    },

  参考自:https://www.cnblogs.com/tlfe/p/11822793.html


免责声明!

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



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