laravel-store-modules
v1.2.2
Published
Base Vuex module classes to work with Laravel.
Downloads
14
Readme
Laravel Store Modules
Installation
npm i laravel-store-modules
Usage
- Create store module
import { ItemsListModule } from 'laravel-store-modules';
export default class Products extends ItemsListModule {
constructor() {
super('/api/product');
}
}
- Create a new Vue component.
<template>
<div>
<product-list-item
v-for="product in products"
:key="product.id"
:product="product"
/>
</div>
</template>
<script>
export default {
name: 'Products',
computed: {
...mapGetters({
products: `products/items`,
}),
created() {
this.getProducts();
},
methods: {
...mapActions({
getProducts: `products/get`,
}),
},
</script>