haoxins

Vue duo

vue and rxjs

Version Version: 1.2.0 Version Updated: 11/27/2017 By: haoxins License: MIT

DownloadsLast30Days: 12

https://github.com/haoxins/vue-duo

npm i vue-duo
yarn add vue-duo

NPM version Build status Test coverage License Dependency status

vue-duo

  • You can handle complex data flow with awesome rxjs.
  • vue-duo provide a tiny store for simple data flow, works fine with vue-rx.

Getting Started

  • app.vue

<template>
  <div>
    <h3>{{ count }}</h3>
    <button @click="add(1)">add</button>
  </div>
</template>

<script>

import { add } from './action'
import store from './store'

export default {
  name: 'app',
  store,
  methods: {
    add
  }
}

</script>
  • action.js

import { createAction } from 'vue-duo'

export const add = createAction((num) => num)
  • store.js

import { createStore } from 'vue-duo'

import { add } from './action'

const store = createStore({
  count: 0
})

store.subscribeActions({
  [add]: (num) => ({
    count: store.state.count + num
  })
})

export default store

Usage

License

MIT