v-flexible-resource
v1.0.4
Published
A Vue mixin that allows you to get resource data from FlexibleResource which is a Laravel package.
Downloads
3
Readme
v-flexible-resource
A Vue mixin that allows you to get resource data from FlexibleResource which is a Laravel package.
Installation
npm i v-flexible-resource --save
Dependency
This package uses axios to get resource data through Ajax.
Usage
Basic usage
This package automatically calls Vue.mixin()
.
So, you don't need to set mixins
.
<script src="/PATH/TO/YOUR/FOLDER/v-flexible-resource/resource.js"></script>
<script>
new Vue({
el: '#app',
data: {
userTypes: {},
userTypeCollection: []
},
mounted() {
var keys = ['userTypes', 'userTypeCollection'];
this.resource(keys);
}
})
</script>
Callback
The second argument of resource()
is for callback.
And callback has resource data.
this.resource(keys, function(data){
console.log(data);
});
Resource URL
You can change resource URL by overwriting resourceUrl
.
new Vue({
el: '#app',
data: {
resourceUrl: '/YOUR/RESOURCE/URL'
},
mounted: function() {
// ...
}
});
License
This package is licensed under the MIT License.
Copyright 2018 Sukohi Kuhoh