You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

JDictSelectTag 组件用法


  • 从字典表获取数据,dictCode格式说明: 字典code
<j-dict-select-tag  v-model="queryParam.sex" placeholder="请输入用户性别"
                  dictCode="sex"/>

v-decorator用法

<j-dict-select-tag  v-decorator="['sex', {}]" :triggerChange="true" placeholder="请输入用户性别"
                  dictCode="sex"/>
  • 从数据库表获取字典数据dictCode格式说明: 表名,文本字段,取值字段
<j-dict-select-tag v-model="queryParam.username" placeholder="请选择用户名称" 
                   dictCode="sys_user,realname,id"/>

JDictSelectUtil.js 列表字典函数用法


  • 第一步: 引入依赖方法
       import {initDictOptions, filterDictText} from '@/components/dict/JDictSelectUtil'
  • 第二步: 在created()初始化方法执行字典配置方法
      //初始化字典配置
      this.initDictConfig();
  • 第三步: 实现initDictConfig方法加载列表所需要的字典(列表上有多个字典项就执行多次initDictOptions方法)
      initDictConfig() {
        //初始化字典 - 性别
        initDictOptions('sex').then((res) => {
          if (res.success) {
            this.sexDictOptions = res.result;
          }
        });
      },
  • 第四步: 实现字段的customRender方法
     customRender: (text, record, index) => {
       //字典值替换通用方法
       return filterDictText(this.sexDictOptions, text);
     }