This commit is contained in:
2024-12-03 17:04:40 +08:00
parent 4677b8dfb8
commit 7bcd64663e
4 changed files with 266 additions and 228 deletions

View File

@@ -1,13 +1,8 @@
<template>
<template v-for="(item, index) in dataList">
<template v-if="values.includes(item.dictValue)">
<el-tag
v-if="dictValues.includes(item.listClass)"
size="small"
:disable-transitions="true"
:index="index"
:type="item.listClass"
:class="item.cssClass">
<el-tag v-if="dictValues.includes(item.listClass)" size="small" :disable-transitions="true" :index="index"
:type="item.listClass" :class="item.cssClass">
<template v-if="item.langKey">
{{ $t(item.langKey) }}
</template>
@@ -67,6 +62,9 @@ const dataList = computed(() => {
})
const values = computed(() => {
if (props.value !== null && typeof props.value !== 'undefined') {
if (typeof props.value === 'number') {
return [props.value]
}
if (props.split != null && props.split != '') {
return props.value.split(props.split) ?? []
} else {
@@ -80,7 +78,7 @@ const dictValues = ref(['primary', 'danger', 'warning', 'info', 'success'])
</script>
<style scoped>
.el-tag + .el-tag {
.el-tag+.el-tag {
margin-left: 10px;
}
</style>