vuex.md 1.3 KB

组件库

移动端

1.Vant https://vant-ui.github.io/vant/#/zh-CN/home

2.Cube https://didi.github.io/cube-ui/#/zh-CN/docs/button

3.Mint https://mint-ui.github.io/#!/zh-cn

PC端

1.iView https://www.iviewui.com/

2.Element https://element.eleme.cn/#/zh-CN/component/installation

Element: 1.安装 2.在main.js中引用

VueX

通过状态(数据源)集中管理驱动组件的变化。页面通过mapActions异步提交事件到actions。actions通过commit把对应参数同步提交到mutations。

mutations会修改state中对于的值。 最后通过getters把对应值跑出去,在页面的计算属性中

通过mapGetters来动态获取state中的值

应用级的状态集中放在store中; 改变状态的方式是提交mutations,这是个同步的事物; 异步逻辑应该封装在actions中。

state中保存着共有数据,数据是响应式的 getters可以对state进行计算操作,主要用来过滤一些数据,可以在多组件之间复用 mutations定义的方法动态修改state中的数据,通过commit提交方法,方法必须是同步的 actions将mutations里面处理数据的方法变成异步的,就是异步操作数据,通store.dispatch来分发actions,把异步的方法写在actions中,通过commit提交mutations,进行修改数据。

modules:模块化vueX