el-select 使用

案例:

/*
* label : 界面上展示的是哪个字段,我这里需要展示名称
* value : 绑定的字段,一般是id
*/

 
            
            
 




//获取 optionLicensesID 值,有两种写法。
methos:{

   /**第一种:直接赋值*/
   getMaterials() {
      this.$BillApi.GetOverLicenses({}).then((res) => {
        this.optionLicensesID = res.data.data;
      });
    },

  /**第二种**/
  optionsData() {
      let param = { DictID: "18" }; //采购类型
      this.$API.SysDictDataGetdata(param).then((res) => {
        let tempDictdata = res.data.data;
        let selectDict = [];
        tempDictdata.forEach((item) => {
          selectDict.push({
            label: item.Model.DataName,
            value: item.Model.DataID,
          });
        });
        this.optionSource = selectDict;
      });
    },
  
}

你可能感兴趣的:(vue,elementui,vue.js,elementui)