Skip to content
a lite vuex
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build
dist
tests/unit
.browserslistrc
.editorconfig
.eslintrc.js
.gitignore
README.md
babel.config.js
jest.config.js
main.js
package.json
postcss.config.js
yarn.lock

README.md

LiteVuex

npm i litevuex

A tiny Vuex. For funzies

store.js

import Vue from "vue";
import litevuex from "litevuex";

Vue.use(litevuex);

let store = {
    state: {
      msg: "No sir"
    },
    actions: {
      inputChanged($store, val) {
        $store.commit('setMessage', val)
      }
    },
    mutations: {
      setMessage($store, val) {
        $store.state.msg = val;
      }
    }
};

litevuex.hug(store);

export default store;

main.js

import Vue from 'vue'
import App from './App.vue'
import Store from './store.js';

Vue.config.productionTip = false
new Vue({
  store: Store,
  render: h => h(App),
}).$mount('#app')

App.vue

<template>
  <div id="app">
    <input type="text" @input="inputted">
    <h1>{{$store.state.msg}}</h1>
  </div>
</template>

<script>
export default {
  name: 'app',
  methods: {
    inputted(e) {
      this.$store.dispatch('inputChanged', e.target.value);
    }
  }
}
</script>
You can’t perform that action at this time.