This commit is contained in:
weiwei committed 2025-02-24 16:02:31 +08:00
1 parent e8ceb6084c
commit f26d9b3b5e
6 files changed
+61 -73

No files matched your search

+11 -10
View File
@@ -2,9 +2,9 @@
<div>
<template v-for="(item, index) in props.options">
<template v-if="values.includes(item.value || item)">
<span v-if="item.elTagType == 'default' || item.elTagType == ''" :key="index" :index="index" :class="item.elTagClass">{{
item.label || item
}}</span>
<span v-if="item.elTagType == 'default' || item.elTagType == ''" :key="index" :index="index" :class="item.elTagClass">
{{ item.label || item }}
</span>
<el-tag
v-else
:disable-transitions="true"
@@ -12,15 +12,16 @@
:index="index"
:type="item.elTagType === 'primary' ? '' : item.elTagType"
:class="item.elTagClass"
>{{ item.label || item }}</el-tag
>
{{ item.label || item }}
</el-tag>
</template>
</template>
</div>
</template>
<script setup lang="ts" name="dict-tag">
import { computed } from 'vue';
import { computed } from "vue"
const props = defineProps({
// 数据
@@ -30,15 +31,15 @@ const props = defineProps({
},
// 当前的值
value: [Number, String, Array],
});
})
const values = computed(() => {
if (props.value !== null && typeof props.value !== 'undefined') {
return Array.isArray(props.value) ? props.value : [String(props.value)];
if (props.value !== null && typeof props.value !== "undefined") {
return Array.isArray(props.value) ? props.value : [String(props.value)]
} else {
return [];
return []
}
});
})
</script>
<style scoped>