RuoYi
2025-04-27 2f8a257efd2b64dc40666b0d332edb7824a9768d
src/components/DictTag/index.vue
@@ -26,7 +26,7 @@
<script setup>
// 记录未匹配的项
const unmatchArray = ref([]);
const unmatchArray = ref([])
const props = defineProps({
  // 数据
@@ -45,15 +45,15 @@
    type: String,
    default: ",",
  }
});
})
const values = computed(() => {
  if (props.value === null || typeof props.value === 'undefined' || props.value === '') return [];
  return Array.isArray(props.value) ? props.value.map(item => '' + item) : String(props.value).split(props.separator);
});
  if (props.value === null || typeof props.value === 'undefined' || props.value === '') return []
  return Array.isArray(props.value) ? props.value.map(item => '' + item) : String(props.value).split(props.separator)
})
const unmatch = computed(() => {
  unmatchArray.value = [];
  unmatchArray.value = []
  // 没有value不显示
  if (props.value === null || typeof props.value === 'undefined' || props.value === '' || !Array.isArray(props.options) || props.options.length === 0) return false
  // 传入值为数组
@@ -65,13 +65,13 @@
    }
  })
  return unmatch // 返回标志的值
});
})
function handleArray(array) {
  if (array.length === 0) return "";
  if (array.length === 0) return ""
  return array.reduce((pre, cur) => {
    return pre + " " + cur;
  });
    return pre + " " + cur
  })
}
</script>