Skip to content

Commit

Permalink
Fixed #903 - Autocomplete crashes when "field" property is a function
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jan 28, 2021
1 parent 48a5271 commit ad5f458
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 {
value?: any;
suggestions?: any[];
field?: string;
field?: string | ((item: any) => any);
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 @@ -45,7 +45,7 @@ export default {
default: null
},
field: {
type: String,
type: [String, Function],
default: null
},
scrollHeight: {
Expand Down Expand Up @@ -462,7 +462,7 @@ export default {
}];
},
inputValue() {
if (this.value) {
if (this.value && typeof this.value === 'object') {
if (this.field) {
const resolvedFieldData = ObjectUtils.resolveFieldData(this.value, this.field);
return resolvedFieldData != null ? resolvedFieldData : this.value;
Expand Down

0 comments on commit ad5f458

Please sign in to comment.