浏览代码

feat: 新增字典渲染组件

喵你个旺呀 1 年之前
父节点
当前提交
a44460fd4d
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      Web/src/components/table/dictLabel.vue

+ 17 - 0
Web/src/components/table/dictLabel.vue

@@ -0,0 +1,17 @@
+<template>
+	<ElTag :type="dict?.tagType ?? ''">{{ dict?.name ?? defaultValue ?? '-' }}</ElTag>
+</template>
+
+<script lang="ts" setup>
+import { useUserInfo } from '/@/stores/userInfo';
+import { reactive } from 'vue';
+import { ElTag } from 'element-plus';
+
+const props = defineProps<{
+	code: string;
+	value: any;
+	defaultValue: string
+}>();
+
+const dict = reactive(useUserInfo().getDictLabelByVal(props.code, props.value));
+</script>