广丰卷烟厂数采质量分析系统
zhuguifei
2026-03-02 80ff784bf60637cd348ae665fc907f7b1e527dd8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script setup lang="ts">
import { useAttrs } from 'vue';
import type { TagProps } from 'naive-ui';
import { isNotNull } from '@/utils/common';
 
defineOptions({
  name: 'BooleanTag'
});
 
const value = defineModel<'0' | '1'>('value', { required: true });
 
const tagMap: Record<'0' | '1', NaiveUI.ThemeColor> = {
  0: 'success',
  1: 'error'
};
 
const attrs: TagProps = useAttrs();
</script>
 
<template>
  <NTag v-if="isNotNull(value)" :type="tagMap[value]" v-bind="attrs">{{ value === '0' ? '是' : '否' }}</NTag>
</template>
 
<style scoped></style>