1.实现效果

2.代码

(1)下拉框

<el-form-item label="业务类型" prop="proKey">
        <el-select
          v-model="form.proKey"
          placeholder="请选择业务类型"
          clearable
          filterable
          style="width: 170px"
        >
          <el-option
            v-for="item in proOptions"
            :key="item.processKey"
            :label="item.processName"
            :value="item.processKey"
          >
          </el-option>
       </el-select>
</el-form-item>

(2)引入对应的数据接口

import { getProcessSelectList } from "@/api/system/process";

(3)定义一个字段 调用接口函数

data() {
    return {
      proOptions: [],
    };
},
created() {
    this.getproKey();
},
methods: {
    getproKey() {
      this.loading = true;
      getProcessSelectList().then((response) => {
          this.proOptions = response.data;
          //console.log(this.proOptions);
        })
        .catch((err) => {
          console.log(err);
        });
     },
},

 附:接口写法

export function getProcessSelectList(query) {
    return request({
      url: '/process/getProcessSelectList',
      method: 'get',
      params: query
    })
  }

Logo

前往低代码交流专区

更多推荐