[Vuejs]-Issue with Vue.js on existing site

0👍

Cannot read property 'length' of undefined means that somehow the undefined value has gotten to a place, where array was expected instead. In this case it means that the <vue-bootstrap-typeahead> is getting undefined via its props, where it expects an array (which is the data prop). But you are passing users there, so how is the error possible?

Even though you are "having users array in the data", it is the data of your vue instance where you have them, not the data of your vue component itself. And your component has no way of knowing about that data. You would need to either define the data and perform fetching of the data in the component itself (like you can see in the base example here: https://v2.vuejs.org/v2/guide/components.html), or alternatively pass the data from the app to your component via props to make it work.

Leave a comment