| | |
| | |
|
| | | <script setup>
|
| | | // 记录未匹配的项
|
| | | const unmatchArray = ref([]);
|
| | | const unmatchArray = ref([])
|
| | |
|
| | | const props = defineProps({
|
| | | // 数据
|
| | |
| | | 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
|
| | | // 传入值为数组
|
| | |
| | | }
|
| | | })
|
| | | 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>
|
| | |
|