Skip to content

Commit

Permalink
Fixed #858 - Autocomplete crashes when "field" property is a function
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Jan 20, 2021
1 parent 59d04e8 commit 1e18b3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/autocomplete/AutoComplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Vue, { VNode } from 'vue';
declare class AutoComplete extends Vue {
modelValue?: any;
suggestions?: any[];
field?: string;
field?: string|function;
scrollHeight?: string;
dropdown?: boolean;
dropdownMode?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/components/autocomplete/AutoComplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default {
default: null
},
field: {
type: String,
type: [String,Function],
default: null
},
scrollHeight: {
Expand Down Expand Up @@ -457,7 +457,7 @@ export default {
},
inputValue() {
if (this.modelValue) {
if (this.field) {
if (this.field && typeof this.modelValue === 'object') {
const resolvedFieldData = ObjectUtils.resolveFieldData(this.modelValue, this.field);
return resolvedFieldData != null ? resolvedFieldData : this.modelValue;
}
Expand Down

0 comments on commit 1e18b3f

Please sign in to comment.