app直播源代码,element的select如何获取选中的对象

发布时间 2023-07-18 14:12:01作者: 云豹科技-苏凌霄

app直播源代码,element的select如何获取选中的对象

 <el-select
          v-model="form.partnerShortName" 
          filterable
          remote
          placeholder="请输入关键词"
          :remote-method="remoteMethod"
          :loading="loading"
          @change="changeChannl"
          value-key="id"
        >
          <el-option
            v-for="item in channllist"
            :key="item.id"
            :label="item.partnerShortName"
            :value="item"
          ></el-option>
        </el-select>
export default {
  data() {
    return {
      form: {
        partnerShortName:'',
      },
      loading:false,
      channllist:[],
      accountList:[]
    };
  },
  methods: {
    changeChannl(row){
      this.form.channelId=row.id;
      this.accountList=row.accountList;
    },
    remoteMethod(data) {
      if (data !== "") {
        this.loading = true;
        setTimeout(() => {
          let query = {
            partnerShortName: data
          };
          this.$api.getChannelByCondition(query).then(res => {
            if (res) {
              if (res.code == 0) {
                this.loading = false;
                this.channllist = res.data.records;
              }else{
                this.channllist=[];
              }
            }
          });
        },200);
      }else{
        this.channllist=[];
      }
    }
  }
};

​ 以上就是app直播源代码,element的select如何获取选中的对象, 更多内容欢迎关注之后的文章