pespantelis / vue-typeahead

:mag: Typeahead component for Vue.js
http://pespantelis.github.io/vue-typeahead
MIT License
517 stars 97 forks source link

Uncaught ReferenceError: _vue is not defined #66

Open rajatonit opened 6 years ago

rajatonit commented 6 years ago

Hi I'm getting the error: Uncaught ReferenceError: _vue is not defined when using the component...

This is where it fails:

fetch: function() { var e = this; if (!this.$http) { return _vue.util.warn('You need to provide a HTTP client', this) <--- } if (!this.src) { return _vue.util.warn('You need to set the src property', this) } var t = this.queryParamName ? this.src : this.src + this.query , n = this.queryParamName ? (0, _assign2.default)((0,

Any help to solve this would be great.

Thanks.

nick-dasilva commented 6 years ago

Hi, I ran into this error too. The quickstart guide in the main Readme isn't very clear on this, but you need to do a couple of things to get the component to work. Your main.js file needs to have the TypeAhead component registered with your Vue instance, and the Vue prototype needs to have an "$http" field that points to an instance of Axios or some other browser-side HTTP client.

This is visible here: https://github.com/pespantelis/vue-typeahead/blob/master/demo/Typeahead.vue

Note lines 3, 5, and 10.

I doubt that this fixes the actual issue of _vue.util being undefined, but at least it will get your fetch() calls working.