Browse Source

优化字典组件值宽松匹配

master
RuoYi 3 months ago
parent
commit
e430dae0dc
  1. 8
      src/components/DictTag/index.vue

8
src/components/DictTag/index.vue

@ -1,7 +1,7 @@
<template>
<div>
<template v-for="(item, index) in options">
<template v-if="values.includes(item.value)">
<template v-if="isValueMatch(item.value)">
<span
v-if="(item.elTagType == 'default' || item.elTagType == '') && (item.elTagClass == '' || item.elTagClass == null)"
:key="item.value"
@ -60,7 +60,7 @@ const unmatch = computed(() => {
//
let unmatch = false //
values.value.forEach(item => {
if (!props.options.some(v => v.value === item)) {
if (!props.options.some(v => v.value == item)) {
unmatchArray.value.push(item)
unmatch = true // true
}
@ -74,6 +74,10 @@ function handleArray(array) {
return pre + " " + cur
})
}
function isValueMatch(itemValue) {
return this.values.some(val => val == itemValue)
}
</script>
<style scoped>

Loading…
Cancel
Save