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-for="(item, index) in options">
<template v-if="values.includes(item.dictValue)"> <template v-if="values.includes(item.dictValue)">
<span v-if="item.listClass == 'default' || item.listClass == ''" :key="item.dictValue" :index="index" :class="item.cssClass"> <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> {{ 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"> <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> {{ item.dictLabel }}<i v-if="showValue">#{{ item.dictValue }}</i>
</el-tag> </el-tag>
</template> </template>
</template> </template>
@ -23,15 +23,15 @@ const props = defineProps({
// //
value: [Number, String, Array], value: [Number, String, Array],
showValue: false, showValue: false,
}); })
const values = computed(() => { const values = computed(() => {
if (props.value !== null && typeof props.value !== "undefined") { if (props.value !== null && typeof props.value !== 'undefined') {
return Array.isArray(props.value) ? props.value : [String(props.value)]; return Array.isArray(props.value) ? props.value : [String(props.value)]
} else { } else {
return []; return []
} }
}); })
</script> </script>
<style scoped> <style scoped>