Browse Source

chore: 🤪消除Invalid prop警告

喵你个旺呀 1 year ago
parent
commit
197a0cb2bc
1 changed files with 4 additions and 7 deletions
  1. 4 7
      Web/src/components/table/dictLabel.vue

+ 4 - 7
Web/src/components/table/dictLabel.vue

@@ -1,5 +1,5 @@
 <template>
-	<el-Tag :type="state.tagType ?? ''">{{ state.label }}</el-Tag>
+	<el-Tag :type="state.tagType">{{ state.label }}</el-Tag>
 </template>
 
 <script lang="ts" setup>
@@ -8,10 +8,7 @@ import { reactive, onMounted, watch } from 'vue';
 
 const props = defineProps({
 	code: String,
-	value: {
-    type: null,
-    default: null
-  },
+	value: null,
 	propLabel: {
 		type: String,
 		default: 'value',
@@ -28,7 +25,7 @@ const props = defineProps({
 
 const state = reactive({
 	label: '' as string,
-	tagType: '' as string,
+	tagType: "primary" as "success" | "warning" | "info" | "primary" | "danger"
 });
 
 onMounted(() => {
@@ -44,7 +41,7 @@ const setDictValue = (value: any) => {
   const dict = useUserInfo().dictList[props.code]?.find((x: any) => x[props.propValue] == value);
   if (dict) {
     state.label = dict[props.propLabel] || props.defaultValue;
-    state.tagType = dict.tagType;
+    state.tagType = dict.tagType ?? "primary";
   }
 }
 </script>