<script setup>
/**
*
@description: 下拉单选控件(自定义数据源)
*/
import { computed } from 'vue';
const props = defineProps({
modelValue: {
type: String,
default: undefined,
},
query: {
type: Object,
default: () => ({}),
},
});
const emit = defineEmits(['update:modelValue']);
const filterOption = (input, option) => {
console.log(input, option);
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
const handleChange = (e) => {
emit('update:modelValue', e);
};
</script>
{{ option.label }}
<style lang="less" scoped></style>
JavaScript 中 Number 类型的数据没有 toLowerCase 方法,会导致filterOption 方法报错