导航


HTML

CSS

JavaScript

浏览器 & 网络

版本管理

框架

构建工具

TypeScript

性能优化

软实力

算法

UI、组件库

Node

业务技能

针对性攻坚

AI


核心思想

Untitled

大纲

Untitled

目标

Untitled

官网链接

https://cn.mobx.js.org/

初始化

Untitled

Untitled

安装 mobx、mobx-react

Untitled

基本使用流程

Untitled

Untitled

Untitled

装饰器

基本用法

Untitled

装饰器传参

Untitled

添加实例属性

Untitled

小案例 mixins

Untitled

修饰类成员

Untitled

Untitled

Untitled

observable 函数

autorun

p.s. 下边会加载完立即执行一次(0),改变数据后会再次执行一次(20)

Untitled

computed 计算属性

Untitled

Untitled

action

Untitled

configure

Untitled

直接修改会报错

Untitled

Untitled

bound 绑定 this

Untitled

runInAction

Untitled

异步 action

  1. 外部再定义一个同步action专门修改状态(推荐)

不能在异步action中直接操作状态,而要再定一个action单独修改,然后在异步action中调用此action

Untitled

  1. 在异步action内部定义同步action

Untitled

  1. 利用 runInAction

Untitled

监听数据的方式

computed

autorun