element-ui 下拉選框直接獲取整個option上綁定的數據

<el-select v-model="value_item" placeholder="請選擇項目" @change="handlerSearch($event, 2)">
    <el-option
    v-for="item in options_item"
    :key="item.projectId"
    :label="item.projectName"
    :value="item.projectId"
    ></el-option>
</el-select>
handlerSearch (e, type) {
  if (type === 1) {
    this.page = 1
    this.getListData()
  } else if (type === 2) {
    let obj = {}
    obj = this.options_item.find((item) => {
      return item.projectId === e
    })
    // console.log(obj)
    let subject = obj['subject']
    this.options_sub = subject
    this.value_sub = subject[0]['subjectId']

    let topicType = obj['topicType']
    this.options_type = topicType
    this.value_type = this.options_type.length > 0 ? topicType[0]['topicTypeId'] : ''

    this.page = 1
    this.getListData()
  }
},

    let obj = {}
    obj = this.options_item.find((item) => {
      return item.projectId === e
    })
    // console.log(obj)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章