mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-09 16:01:09 +08:00
style: 优化代码
This commit is contained in:
@@ -41,11 +41,14 @@ const label = computed<number | string>(() => {
|
||||
const current = props.dicts.find((item) => item.dictValue == props.value);
|
||||
return current?.dictLabel ?? 'unknown';
|
||||
});
|
||||
|
||||
const tagComponent = computed(() => (color.value ? Tag : 'div'));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<Tag v-if="color" :class="cssClass" :color="color">{{ label }}</Tag>
|
||||
<div v-if="!color" :class="cssClass">{{ label }}</div>
|
||||
<component :is="tagComponent" :class="cssClass" :color="color">
|
||||
{{ label }}
|
||||
</component>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user