Djinn-state vue
Djinn-state helpers for vue
Install
npm npm i --save djinn-state djinn-state-vue
yarn yarn add djinn-state djinn-state-vue
Examples
Using
// djinn.jsimport Djinn DjinnService from 'djinn-state';import createDjinnConnector from 'djinn-state-vue'; const djinn = ;const connect = ; // CounterService.js state = count: 0 ; { const count = thisstatecount - 1; this; }; { const count = thisstatecount + 1; this; }; // djinnServices.jsimport djinn from './djinn'; djinn;djinn; // main.jsimport './djinnServices.js'
Counter.vue
<template> <div> <button @click="services.CounterService.decrement()">-</button> {{state.CounterService.count}} <button @click="services.CounterService.increment()">+</button> </div></template> <script> import {connect} from './djinn'; import {CounterService} from './CounterService'; export default { name: 'Counter', mixins: [connect({CounterService})], };</script>