兰宝车间质量管理系统-前端
疯狂的狮子Li
2023-04-03 1595cb282aab5399862fac6406b5de550863e3b6
src/components/DictTag/index.vue
@@ -1,25 +1,3 @@
<script setup lang="ts">
import { PropType } from 'vue';
const props = defineProps({
  // 数据
  options: {
    type: Array as PropType<DictDataOption[]>,
    default: null,
  },
  // 当前的值
  value: [Number, String, Array],
})
const values = computed(() => {
   if (props.value !== null && typeof props.value !== 'undefined') {
      return Array.isArray(props.value) ? props.value : [String(props.value)];
   } else {
      return [];
   }
})
</script>
<template>
   <div>
      <template v-for="(item, index) in options">
@@ -45,6 +23,28 @@
   </div>
</template>
<script setup lang="ts">
import { PropType } from 'vue';
const props = defineProps({
    // 数据
    options: {
        type: Array as PropType<DictDataOption[]>,
        default: null,
    },
    // 当前的值
    value: [Number, String, Array],
})
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;