src下创建新的共享数据文件test.js
import {
observable, computed, action, autorun,runInAction, configure,makeAutoObservable} from 'mobx';
import Unit from "../unit/index";
configure({
enforceActions: 'observed' })//开启严格模式
// https://cn.mobx.js.org/best/actions.html#runinaction-%E5%B7%A5%E5%85%B7%E5%87%BD%E6%95%B0
class Store {
@observable cls="web1908"
constructor(){
makeAutoObservable(this)
}
@observable resume={
base:{
name:"",
age:"",
sex:""
},
exp:{
}
}
@action
update=()=>{
this.cls="web1908A";
this.resume={
base:{
name:"张",
age:"22",
sex:"男