0.2.6 • Published 6 years ago

laravel-vuex v0.2.6

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Laravel Vuex (Client) - WIP

This is the Vuejs client package for Laravel Vuex.

Installation

npm install -S laravel-vuex

Configuration

Bring Echo events to your Stores

Use the built-in StoreCommiter for a quick start :

// Prepare your echo configuration
import Echo from 'laravel-echo'
let echo = new Echo({ ... })

// Load your vuex store object (in my example i just put it inside a ./store.js)
import store from './store'

// Set the channels you want to use (by default "public")
let channels = ['public']

// Map the events with the StoreCommiter
import StoreCommiter from 'laravel-vuex/store-commiter'
Vue.use(StoreCommiter, { echo, channels, store })

Configure Vuex

For each of your laravel models you should create a corresponding store module with the plural, snake case name of your class. Below the examples corresponding to the server-side example.

Main store :
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

import cars from './modules/cars'

export default new Vuex.Store({
  modules: {
    cars
  }
})
cars store module :
import EventMutations from 'laravel-vuex/mutations/event-mutations'

const state = {
  all: []
}

const getters = {
  all: state => state.all
}

const actions = {}

const mutations = EventMutations.get()

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
}

Example

Take a look at the Laravel Vuex Js Example.

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago