update DictTag/index.vue

This commit is contained in:
不做码农 2022-04-26 08:46:58 +08:00
parent 3cdcf5303f
commit 506f9446b2

View File

@ -3,10 +3,10 @@
<template v-for="(item, index) in options">
<template v-if="values.includes(item.dictValue)">
<span v-if="item.listClass == 'default' || item.listClass == ''" :key="item.dictValue" :index="index" :class="item.cssClass">
{{ item.dictLabel }} <i v-if="showValue">#{{item.dictValue}}</i></span>
<el-tag size="small" v-else :disable-transitions="true" :key="item.dictValue" :index="index"
:type="item.listClass == 'primary' ? '' : item.listClass" :class="item.cssClass">
{{ item.dictLabel }}<i v-if="showValue">#{{item.dictValue}}</i>
{{ item.dictLabel }} <i v-if="showValue">#{{ item.dictValue }}</i></span
>
<el-tag size="small" v-else :disable-transitions="true" :index="index" :type="item.listClass == 'primary' ? '' : item.listClass" :class="item.cssClass">
{{ item.dictLabel }}<i v-if="showValue">#{{ item.dictValue }}</i>
</el-tag>
</template>
</template>
@ -23,15 +23,15 @@ const props = defineProps({
//
value: [Number, String, Array],
showValue: false,
});
})
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>