Skip to content

前端引用字段码表

在 vue 页面,导入 dicts,以及后续待导入的 码表类型:

javascript
<script>
  export default {
    name: "Repo",
    dicts: ['parcel_state'],
    data() {
    }
}
</script>

普通表单引用:

xml
<el-select v-model="queryParams.parcelState" size="mini"  placeholder="Parcel状态" clearable>
    <el-option
        v-for="dict in dict.type.parcel_state"
        :key="dict.value"
        :label="dict.label"
        :value="dict.value"></el-option>
</el-select>

列表引用:

xml
<el-table-column label="PARCEL_STATE" align="center" >
    <template slot-scope="scope">
        <el-select v-model="scope.row.parcelState" disabled size="mini"  placeholder="请选择">
            <el-option
                  v-for="dict in dict.type.parcel_state"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
            ></el-option>
        </el-select>
    </template>
</el-table-column>