vue渲染select下拉框的值

简介: vue渲染select下拉框的值
<template>
  <div class="tab-container">
    <div class="filter-container" style="margin-bottom: 20px">
      <el-select
        placeholder="全部部门"
        clearable
        style="width: 150px"
        class="filter-item"
        v-model="questionForm.userGrades"
      >
        <el-option
          v-for="item in getOrganList"
          :key="item.id"
          :label="item.organName"
          :value="item.id"
        ></el-option>
      </el-select>
    </div>
  </div>
</template>
<script>
//调用接口
import { getOrgan } from "@/api/alarm/query";
export default {
  data() {
    return {
       questionForm: {
      },
      getOrganList: [],
    };
  },
  created() {
    //加载部门
    this.getOrgan();
  },
  methods: {
    //获取部门信息接口定义
    getOrgan() {
      const params = {
        organId: 1,
        authority: 1,
      };
      getOrgan(params).then((res) => {
        this.getOrganList = res.data.organs;
      });
    },
  },
};
</script>
<style scoped>
.tab-container {
  margin: 30px;
}
</style>

json数据

{"msg":"success","code":1,"data":{"organIds":[1,2,10,11,12,13,14,15,16,17,18],"organs":[{"id":1,"organName":"部门1","parentId":0,"manager":"zs","phone":null,"companyId":1,"address":null},{"id":2,"organName":"test3","parentId":1,"manager":"zs","phone":null,"companyId":1,"address":null},{"id":10,"organName":"test4","parentId":1,"manager":"zs","phone":null,"companyId":1,"address":null},{"id":11,"organName":"2121","parentId":1,"manager":"212","phone":"13661725475","companyId":1,"address":null},{"id":12,"organName":"212121212","parentId":2,"manager":"212","phone":"12121","companyId":1,"address":null},{"id":13,"organName":"www","parentId":11,"manager":"ww","phone":"123","companyId":1,"address":null},{"id":14,"organName":"www","parentId":11,"manager":"ww","phone":"123","companyId":1,"address":null},{"id":15,"organName":"","parentId":null,"manager":"","phone":"","companyId":1,"address":null},{"id":16,"organName":"21212","parentId":null,"manager":"","phone":"","companyId":1,"address":null},{"id":17,"organName":"2131314","parentId":null,"manager":"","phone":"","companyId":1,"address":null},{"id":18,"organName":"q313","parentId":2,"manager":"","phone":"","companyId":1,"address":null}]}}
相关文章
|
1天前
|
Web App开发 编解码 JavaScript
【Vue篇】Vue 项目下载、介绍(详细版)
【Vue篇】Vue 项目下载、介绍(详细版)
8 3
|
1天前
|
JavaScript
vue知识点
vue知识点
12 3
|
1天前
|
JavaScript
vue打印v-model 的值
vue打印v-model 的值
|
1天前
|
JavaScript
Vue实战-组件通信
Vue实战-组件通信
7 0
|
1天前
|
JavaScript
Vue实战-将通用组件注册为全局组件
Vue实战-将通用组件注册为全局组件
7 0
|
JavaScript 测试技术 容器
Vue2+VueRouter2+webpack 构建项目
1). 安装Node环境和npm包管理工具 检测版本 node -v npm -v 图1.png 2). 安装vue-cli(vue脚手架) npm install -g vue-cli --registry=https://registry.
989 0
|
1天前
|
JavaScript
VUE里的find与filter使用与区别
VUE里的find与filter使用与区别
22 0
|
1天前
|
JavaScript
vue页面加载时同时请求两个接口
vue页面加载时同时请求两个接口
|
1天前
|
JavaScript
vue里样式不起作用的方法,可以通过deep穿透的方式
vue里样式不起作用的方法,可以通过deep穿透的方式
14 0
|
1天前
|
移动开发 JavaScript 应用服务中间件
vue打包部署问题
Vue项目`vue.config.js`中,`publicPath`设定为&quot;/h5/party/pc/&quot;,在线环境基于打包后的`dist`目录,而非Linux的`/root`。Nginx代理配置位于`/usr/local/nginx/nginx-1.13.7/conf`,包含两个相关配置图。
vue打包部署问题