Fixed #858 - Autocomplete crashes when "field" property is a function

pull/880/head
Cagatay Civici 2021-01-20 12:23:37 +03:00
parent 59d04e8344
commit 1e18b3f26c
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ import Vue, { VNode } from 'vue';
declare class AutoComplete extends Vue { declare class AutoComplete extends Vue {
modelValue?: any; modelValue?: any;
suggestions?: any[]; suggestions?: any[];
field?: string; field?: string|function;
scrollHeight?: string; scrollHeight?: string;
dropdown?: boolean; dropdown?: boolean;
dropdownMode?: string; dropdownMode?: string;

View File

@ -46,7 +46,7 @@ export default {
default: null default: null
}, },
field: { field: {
type: String, type: [String,Function],
default: null default: null
}, },
scrollHeight: { scrollHeight: {
@ -457,7 +457,7 @@ export default {
}, },
inputValue() { inputValue() {
if (this.modelValue) { if (this.modelValue) {
if (this.field) { if (this.field && typeof this.modelValue === 'object') {
const resolvedFieldData = ObjectUtils.resolveFieldData(this.modelValue, this.field); const resolvedFieldData = ObjectUtils.resolveFieldData(this.modelValue, this.field);
return resolvedFieldData != null ? resolvedFieldData : this.modelValue; return resolvedFieldData != null ? resolvedFieldData : this.modelValue;
} }