<template>
|
<div>
|
<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.listClass"
|
>{{ item.dictLabel }}</span>
|
<el-tag
|
v-else
|
:disable-transitions="true"
|
:key="item.dictValue + ''"
|
:index="index"
|
:type="item.listClass"
|
:class="item.listClass"
|
>{{ item.dictLabel }}</el-tag>
|
</template>
|
</template>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import {computed} from "vue";
|
interface PropsI {
|
options:Array<any>,
|
value:any
|
}
|
const props = defineProps<PropsI>()
|
|
const values = computed(() => {
|
if (props.value !== null && typeof props.value !== 'undefined') {
|
return Array.isArray(props.value) ? props.value : [String(props.value)];
|
} else {
|
return [];
|
}
|
})
|
|
</script>
|
|
<style scoped>
|
.el-tag + .el-tag {
|
margin-left: 10px;
|
}
|
</style>
|