# mobx-miniprogram
可用于小程序的 MobX 构建版本。基于 MobX 4 (因为 iOS 9 不支持 MobX 5 )。
`npm install mobx-miniprogram --save`
以下是 MobX 原本的 README 。
<img src="docs/mobx.png" alt="logo" height="120" align="right" />
# MobX
_Simple, scalable state management_
[![CircleCI](https://circleci.com/gh/mobxjs/mobx/tree/mobx4-master.svg?style=svg)](https://circleci.com/gh/mobxjs/mobx/tree/mobx4-master)
[![Coverage Status](https://coveralls.io/repos/mobxjs/mobx/badge.svg?branch=master&service=github)](https://coveralls.io/github/mobxjs/mobx?branch=master)
[![Join the chat at https://gitter.im/mobxjs/mobx](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mobxjs/mobx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Discuss MobX on Hashnode](https://hashnode.github.io/badges/mobx.svg)](https://hashnode.com/n/mobx)
[![OpenCollective](https://opencollective.com/mobx/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/mobx/sponsors/badge.svg)](#sponsors)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
MobX is proudly sponsored by Mendix, Coinbase, Facebook Open Source and many [individual sponsors](#backers)
<img src="docs/mendix-logo.png" align="center" width="100" title="Mendix" alt="Mendix" /> <img src="docs/coinbase.jpeg" align="center" width="100" title="Coinbase" alt="Coinbase" /> <img src="docs/fbos.jpeg" align="center" width="100" title="Facebook Open Source" alt="Facebook Open Source" />
# Installation
* Installation: `npm install mobx --save`. React bindings: `npm install mobx-react --save`. To enable ESNext decorators (optional), see below.
* CDN:
- https://unpkg.com/mobx/lib/mobx.umd.js
- https://cdnjs.com/libraries/mobx
## Translations
* [中文](http://cn.mobx.js.org)
## Getting started
* <i><a style="color: white; background:green;padding:5px;margin:5px;border-radius:2px" href="https://egghead.io/courses/manage-complex-state-in-react-apps-with-mobx">Egghead.io course</a></i>
* [Ten minute, interactive MobX + React tutorial](https://mobxjs.github.io/mobx/getting-started.html)
* [Official MobX 4 documentation and API overview](https://mobxjs.github.io/mobx/refguide/api.html) ([MobX 3](https://github.com/mobxjs/mobx/blob/54557dc319b04e92e31cb87427bef194ec1c549c/docs/refguide/api.md), [MobX 2](https://github.com/mobxjs/mobx/blob/7c9e7c86e0c6ead141bb0539d33143d0e1f576dd/docs/refguide/api.md))
* Videos:
* [ReactNext 2016: Real World MobX](https://www.youtube.com/watch?v=Aws40KOx90U) - 40m [slides](https://docs.google.com/presentation/d/1DrI6Hc2xIPTLBkfNH8YczOcPXQTOaCIcDESdyVfG_bE/edit?usp=sharing)
* [Practical React with MobX](https://www.youtube.com/watch?v=XGwuM_u7UeQ). In depth introduction and explanation to MobX and React by Matt Ruby on OpenSourceNorth (ES5 only) - 42m.
* LearnCode.academy MobX tutorial [Part I: MobX + React is AWESOME (7m)](https://www.youtube.com/watch?v=_q50BXqkAfI) [Part II: Computed Values and Nested/Referenced Observables (12m.)](https://www.youtube.com/watch?v=nYvNqKrl69s)
* [Screencast: intro to MobX](https://www.youtube.com/watch?v=K8dr8BMU7-8) - 8m
* [Talk: State Management Is Easy, React Amsterdam 2016 conf](https://www.youtube.com/watch?v=ApmSsu3qnf0&feature=youtu.be) ([slides](https://speakerdeck.com/mweststrate/state-management-is-easy-introduction-to-mobx))
* [Boilerplates and related projects](http://mobxjs.github.io/mobx/faq/boilerplates.html)
* More tutorials, blogs, videos, and other helpful resources can be found on the [MobX awesome list](https://github.com/mobxjs/awesome-mobx#awesome-mobx)
## Introduction
MobX is a battle tested library that makes state management simple and scalable by transparently applying functional reactive programming (TFRP).
The philosophy behind MobX is very simple:
_Anything that can be derived from the application state, should be derived. Automatically._
which includes the UI, data serialization, server communication, etc.
<img alt="MobX unidirectional flow" src="docs/flow.png" align="center" />
React and MobX together are a powerful combination. React renders the application state by providing mechanisms to translate it into a tree of renderable components. MobX provides the mechanism to store and update the application state that React then uses.
Both React and MobX provide optimal and unique solutions to common problems in application development. React provides mechanisms to optimally render UI by using a virtual DOM that reduces the number of costly DOM mutations. MobX provides mechanisms to optimally synchronize application state with your React components by using a reactive virtual dependency state graph that is only updated when strictly needed and is never stale.
## Core concepts
MobX has only a few core concepts. The following snippets can be tried online using [codesandbox example](https://codesandbox.io/s/v3v0my2370).
### Observable state
<i><a style="color: white; background:green;padding:5px;margin:5px;border-radius:2px" href="https://egghead.io/lessons/javascript-sync-the-ui-with-the-app-state-using-mobx-observable-and-observer-in-react">Egghead.io lesson 1: observable & observer</a></i>
MobX adds observable capabilities to existing data structures like objects, arrays and class instances.
This can simply be done by annotating your class properties with the [@observable](http://mobxjs.github.io/mobx/refguide/observable-decorator.html) decorator (ES.Next).
```javascript
import { observable } from "mobx"
class Todo {
id = Math.random();
@observable title = "";
@observable finished = false;
}
```
Using `observable` is like turning a property of an object into a spreadsheet cell.
But unlike spreadsheets, these values can be not only primitive values, but also references, objects and arrays.
If your environment doesn't support decorator syntax, don't worry.
You can read [here](http://mobxjs.github.io/mobx/best/decorators.html) about how to set them up.
Or you can skip them altoghether, as MobX can be used fine without decorator _syntax_, by leveraging the _decorate_ utility.
Many MobX users do prefer the decorator syntax though, as it is slightly more concise.
```javascript
import { decorate, observable } from "mobx"
class Todo {
id = Math.random();
title = "";
finished = false;
}
decorate(Todo, {
title: observable,
finished: observable
})
```
### Computed values
<i><a style="color: white; background:green;padding:5px;margin:5px;border-radius:2px" href="https://egghead.io/lessons/javascript-derive-computed-values-and-manage-side-effects-with-mobx-reactions">Egghead.io lesson 3: computed values</a></i>
With MobX you can define values that will be derived automatically when relevant data is modified.
By using the [`@computed`](http://mobxjs.github.io/mobx/refguide/computed-decorator.html) decorator or by using getter / setter functions when using `(extend)Observable` (Of course, you can use `decorate` here again as alternative to the `@` syntax).
```javascript
class TodoList {
@observable todos = [];
@computed get unfinishedTodoCount() {
return this.todos.filter(todo => !todo.finished).length;
}
}
```
MobX will ensure that `unfinishedTodoCount` is updated automatically when a todo is added or when one of the `finished` properties is modified.
Computations like these resemble formulas in spreadsheet programs like MS Excel. They update automatically and only when required.
### Reactions
<i><a style="color: white; background:green;padding:5px;margin:5px;border-radius:2px" href="https://egghead.io/lessons/react-write-custom-mobx-reactions-with-when-and-autorun">Egghead.io lesson 9: custom reactions</a></i>
Reactions are similar to a computed value, but instead of producing a new value, a reaction produces a side effect for things like printing to the console, making network requests, incrementally up
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】: 包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。 包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。 【项目质量】: 所有源码都经过严格测试,可以直接运行。 功能在确认正常工作后才上传。 【适用人群】: 适用于希望学习不同技术领域的小白或进阶学习者。 可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。 【附加价值】: 项目具有较高的学习借鉴价值,也可直接拿来修改复刻。 对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。 【沟通交流】: 有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
收起资源包目录
基于微信小程序的图书馆座位预约系统,后端(SpringBoot+MyBatis+redis),微信小程序,Vue2.zip (430个子文件)
.babelrc 202B
conf 8B
common.css 552B
Dockerfile 477B
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
mobx.js.flow 15KB
.gitignore 394B
index.html 2KB
favicon.ico 162KB
favicon.ico 162KB
maven-wrapper.jar 57KB
LoginService.java 14KB
ReceiveService.java 11KB
SchoolService.java 9KB
LibraryRoomService.java 8KB
LibraryService.java 6KB
ReceiveSchedule.java 5KB
CodeUtil.java 5KB
CodeUtil.java 5KB
UserService.java 5KB
LibrarySeatService.java 5KB
SmsUtil.java 5KB
SmsUtil.java 5KB
EmailUtil.java 5KB
EmailUtil.java 5KB
ReceiveFastService.java 4KB
WxServiceImpl.java 4KB
LibraryTableService.java 4KB
LoginController.java 3KB
RedisTool.java 3KB
JwtConfig.java 3KB
SchoolNotificationService.java 3KB
HttpClientUtil.java 3KB
HttpClientUtil.java 3KB
SchoolNotificationController.java 3KB
ReceiveFastController.java 3KB
LibraryRoomController.java 3KB
ReceiveController.java 3KB
LibraryController.java 3KB
UserInfoService.java 3KB
UserInfoController.java 3KB
CheckObjectIsNullUtils.java 2KB
CheckObjectIsNullUtils.java 2KB
UserController.java 2KB
ReceiveItemResponse.java 2KB
TokenInterceptor.java 2KB
FileUploadController.java 2KB
ResMap.java 2KB
ResMap.java 2KB
FileDownload.java 2KB
LibraryFeedbackService.java 2KB
ClockService.java 2KB
SchoolController.java 2KB
UserDao.java 2KB
LibraryFeedbackController.java 2KB
SchoolNotificationDao.java 2KB
LibraryRoomDao.java 2KB
LibrarySeatDao.java 2KB
UserLearnedDao.java 2KB
CquptInfoDao.java 2KB
UserCreditDao.java 2KB
LibraryFeedbackDao.java 2KB
LibraryDao.java 2KB
ReceiveItemService.java 2KB
WebInterceptor.java 2KB
UserInfoDao.java 2KB
ReceiveItemDao.java 2KB
LibraryTableDao.java 2KB
MyExceptionHandler.java 2KB
UserSchoolDao.java 2KB
MyExceptionHandler.java 2KB
ReceiveFastDao.java 2KB
SchoolRuleDao.java 2KB
UserRecordDao.java 2KB
UserOnlineDao.java 2KB
UserOnlineService.java 2KB
SchoolDao.java 2KB
LibrarySeatController.java 2KB
LibraryTableController.java 2KB
SchoolRuleService.java 2KB
SchoolRuleController.java 2KB
Library.java 2KB
TimeUtil.java 1KB
TimeUtil.java 1KB
ClockController.java 1KB
UserOnlineController.java 1KB
RedisConfig.java 1KB
CommonController.java 1KB
ReceiveItem.java 1KB
WXController.java 1KB
MyException.java 1KB
SchoolNotification.java 1KB
MyException.java 1KB
LibraryFeedback.java 1KB
LibraryRoom.java 1KB
LibrarySeat.java 1008B
WxUtil.java 960B
共 430 条
- 1
- 2
- 3
- 4
- 5
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于SpringBoot+Vue的校医院挂号平台(前端代码)
- (源码)基于NodeMCU框架的NodeHealthGuard系统心脏健康早期预警系统.zip
- 基于SpringBoot+Vue的校医院挂号平台(后端代码)
- (源码)基于PyTorch的图像分类模型训练与评估系统.zip
- AT89C52单片机加LCD12864实现贪吃蛇游戏
- (源码)基于Java的研究生管理系统.zip
- (源码)基于SpringBoot和Vue的社区论坛系统.zip
- (源码)基于Python的自动安卓APK安装系统.zip
- (源码)基于SpringBoot和Netty的即时通讯系统.zip
- (源码)基于SpringBoot和Vue的小区物业后台管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功