vuex-connect-layer
v1.0.1
Published
use vuex by model
Downloads
6
Readme
vuex-connect-layer
Using vuex with connect
Build Setup
##install
npm i vuex-connect-layer
将业务功能细分为容器组件与视图组件,同时改变vuex的使用方法,自动将store的state commit mutation action映射到 视图组件上 ###.container
import connector from 'vuex-connect-layer'
import connectViewList from '../components/connectViewList.vue'
import store from '../vuex/index.js'
const mapProps = {
mapStateToProps: {
comments: state => state.comments
},
mapDispatchToProps: {
fetch: 'fetchComments'
}
}
const h = connector.connect(mapProps, store)(connectViewList)
export default h
###use in view components
<connect-container type="这是prop"></connect-container>