RuoYi
2022-05-27 719e0853fa45fa905d9cddc1b66eddf7e2b64563
修复自定义字典样式不生效问题
已修改3个文件
9 ■■■■■ 文件已修改
src/components/DictTag/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/dict.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/DictTag/index.vue
@@ -6,7 +6,7 @@
          v-if="item.elTagType == 'default' || item.elTagType == ''"
          :key="item.value"
          :index="index"
          :class="item.elTagType"
          :class="item.elTagClass"
        >{{ item.label }}</span>
        <el-tag
          v-else
@@ -14,7 +14,7 @@
          :key="item.value + ''"
          :index="index"
          :type="item.elTagType === 'primary' ? '' : item.elTagType"
          :class="item.elTagType"
          :class="item.elTagClass"
        >{{ item.label }}</el-tag>
      </template>
    </template>
src/main.js
@@ -25,7 +25,7 @@
import './permission' // permission control
import { useDict } from '@/utils/dict'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel } from '@/utils/ruoyi'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
// 分页组件
import Pagination from '@/components/Pagination'
@@ -52,6 +52,7 @@
app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels
// 全局组件挂载
app.component('DictTag', DictTag)
src/utils/dict.js
@@ -9,7 +9,7 @@
    args.forEach((d, index) => {
      res.value[d] = [];
      getDicts(d).then(resp => {
        res.value[d] = resp.data.map(p => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass }))
        res.value[d] = resp.data.map(p => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass }))
      })
    })
    return toRefs(res.value);