Posts

Showing posts from May, 2020

Vue ajax search component

So as i was on my journey learning and creating www.worknxt.com , i needed a Vue component that: when user type it goes and call an end point. replace part of the URL with search text. coming back with results, user can select one but then the value that go up to parent is like and Id value of selected item while keep the display text of the component on another value. everything should be assigned through props so this can be reused. i googled but couldn't find any free Vue component that accomplish this and satisfy my requirements. below code is what i ended up with, let me know what you think, it needs some work on responding to keyboard keys like down arrow but i think it's a good start, so i though to share. Vue.component('vue-autocompleteajax', { props: { placeHolderText: String, minLengthToSearch: { type: Number, default: 1 }, ajaxUrl: String, partToReplace: String, idProperty: String, textProperty: String,