v-select-box-vuex
Description
A helper used to create the store modules for the v-select-box, a vue.js component that provides a list with search and pagination.
Installation
npm install v-select-box-vuex
Usage
//module.js const base = 'http://localhost:1234/api' //A simple string with the url of your api. const endpoint = name: 'Users' // The name to access the actions and getters in your store resource: '/users' // The relative path of your resource in your api. { // This function will map your api response to the v-select-box default item format return id: Id text: Name selected: false } const modules = endpointname: // This is a store module ready to be imported namespaced: true modules
//store.js Vue Vuex
Details
Currently, your api response should have this fixed format:
As long as those properties are there, everything should work. To access your newly created store module, the name provided before must be used. For the case of the example above, the actions and getters would be:
// Getters ... //Actions ... //Methods { return this } //v-select-box options object const options: multiSelect: false items: this.itemsUsers onSelect: this.selectItemUsers onSearch: this.onSearchUsers page: this.pageUsers pageCount: this.pageCountUsers loadMore: this.requestUsers clearItems: this.clearUsers params: search: 'name' pageSize: 'size' } }
New Features
This helper is still rough around the edges but it will improve overtime. Some much needed features are being worked on, they'll be put here as soon as they're ready.
Your feedback is appreciated!