首先:項目里的數據字典路由已經配好


進入項目頁面

引入數據字典
import { getTypeValue } from '@/api/dict/dictValue/index';

創建前獲取到字典
getTypeValue('org_attr_type').then(response => {
this.attrTypeOptions = response.data.rows;
});

設置el下拉框
<el-form-item label="屬性類型" prop="type">
<el-select class="filter-item" v-model="form.attrType" placeholder="請選擇機構類型">
<el-option v-for="item in attrTypeOptions" :key="item.id" :label="item.labelDefault"
:value="item.value"></el-option>
</el-select>
</el-form-item>

注意上面的寫法是錯誤的,注意:key,:label, :value值

搜索列表也顯示
<el-table-column width="200px" align="center" label="屬性類型">
<template slot-scope="scope">
<span>{{scope.row.attrType}}</span>
</template>
</el-table-column>

