调用后端接口方法

1: 

  <Select
    v-model="adddata.section"
    clearable
    filterable
    @on-change="getUser"
    class="searchSelect"
   >
     <Option
       v-for="item in departList"
       :value="item.id"
       :key="item.id"
     >{
   
   { item.title }}</Option>
   </Select>
 getUser (value) {
   let section = '';
   if (value) {
      section = value;
   }
   let data = { sectionid: section };
   this.request(
     '/config/ProjectUser/getUserListsBySectionId',
      data,
      'get'
    ).then(res => {
     if (res.data.ret == 1) {
        this.staffList = res.data.data;
      }
    });
 },

    1:   Select : 下拉框选择事件: on-change: 事件默认传递value 值: 

    2: 定义一个新变量: let section = ”“; if (value) { section = value };

    3:   let data = { sectionid = section(value)值 }

   

猜你喜欢

转载自blog.csdn.net/weixin_45677987/article/details/114882437