添加一个讲解如何使用MobX的Demo

This commit is contained in:
leo
2019-02-03 14:59:34 +08:00
parent d5b006beb7
commit 7c19bf2d99
28 changed files with 26540 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { observable, action } from "mobx";
export class StoreHello {
private static instance: StoreHello = null;
public static getInstance() {
if (this.instance == null) {
this.instance = new StoreHello();
}
return this.instance;
}
@observable
public count: number = 0;
@action
public addCount() {
this.count = this.count || 0;
this.count++;
}
}