haoxins / vue-duo

vue + rxjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NPM version Build status Test coverage License Dependency status

Deprecated, try movue

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

About

vue + rxjs


Languages

Language:JavaScript 68.7%Language:Vue 27.9%Language:HTML 3.4%