dva-vue


Keywords
dva, redux, redux-saga, vue, vue-router
License
MIT
Install
npm install dva-vue@0.0.12

Documentation

dva-vue

NPM version Build Status Coverage Status NPM downloads Dependencies js-standard-style MIT

NPM

Lightweight front-end framework based on dva-core and history

Demos & Plugins


Install

$ npm install --save dva-vue

Usage Example

<template>
    <div>
        <div>count: {{count}}</div>
        <div @click="add"></div>
    </div>
</template>
<script>
    import {connect} from 'dva-vue'
    export default connect(({count}) => ({count}))({
      methods: {
        add () {
          this.dispatch({type: 'count/add'}).then(()=>console.log('done'))
        }
      }
    })
</script>
import dva, { createHashHistory } from 'dva-vue'
import App from 'App.vue'
const app = dva({
  history: createHashHistory() // 默认值
})
app.model({
  namespace: 'count',
  state: 0,
  reducers: {
    add (state, { payload }) { return state + payload || 1 },
    minus (state, { payload }) { return state - payload || 1 }
  }
})
app.router(() => [{ path: '/', component: App }])
app.start('#root')

API Reference

import dva, { 
    connect,
    dynamic
} from 'dva-vue'

LICENSE

MIT