diff --git a/src/components/mdInputContainer/mdAutocomplete.vue b/src/components/mdInputContainer/mdAutocomplete.vue index a733262..abbf9fa 100644 --- a/src/components/mdInputContainer/mdAutocomplete.vue +++ b/src/components/mdInputContainer/mdAutocomplete.vue @@ -22,7 +22,7 @@ {{ item.name }} + @click.native="hit(item)">{{ item[printAttribute] }} @@ -47,6 +47,10 @@ type: String, default: 'q' }, + printAttribute: { + type: String, + default: 'name' + }, minChars: { type: Number, default: 1 @@ -122,15 +126,16 @@ this.fetchUrl; }, hit(item) { - // util.warn('You need to implement the `onHit` method', this); - this.query = item.name; - this.$refs.input.value = item.name; + debugger; + this.query = item[this.printAttribute]; + this.$refs.input.value = item[this.printAttribute]; this.selected = item; this.onInput(); }, onInput() { this.updateValues(); - this.$emit('input', this.selected, this.$refs.input.value); + this.$emit('change', this.$refs.input.value); + this.$emit('input', this.$refs.input.value); this.$emit('selected', this.selected, this.$refs.input.value); }, reset() {