mobx 常用注解
@computed
Decorator that can be used on ES6 or TypeScript derivable class properties to make them observable. The @computed can only be used on get functions for instance properties.
@computed 可以用在 ES6 或 TypeScript 属性上面,使属性可以被观测(observable).
而且@computed 仅仅使用在 get方法上
Use @computed if you have a value that can be derived in a pure manner from other observables.
如果有一个值是从被观测的变量(observables)中衍生出来的,那么就使用@computed
use @computed if you want to reactively produce a new value that can be used by other observers
如果你需要产生一个新变量值被其他观察者(observers)使用,那么就使用@computed
@computed can be parameterized. @computed({asStructure: true}) makes sure that the result of a derivation is compared structurally instead of referentially with its preview value. This makes sure that observers of the computation don't re-evaluate if new structures are returned that are structurally equal to the original ones. This is very useful when working with point, vector or color structures for example. It behaves the same as the asStructure modifier for observable values.
Property getters will be automatically turned into derived properties, just like @computed would do.
getter方法会自动加上@computed
Deprecated Argumentless functions will be automatically turned into derived properties, just like @computed would do.
无参方法会自动加上@computed.
注意: @computed get 不要忘了return
参考:
https://mobxjs.github.io/mobx/refguide/object.html
https://mobxjs.github.io/mobx/refguide/computed-decorator.html
相关推荐
mobX vs redux mobX vs redux
轻量级mobx实现
mobx-ssr-example, 基于响应和mobX的服务器端呈现 mobx-ssr-example使用mobX进行服务器端渲染构建和运行npm installnpm run build:clientnpm run start在端口 3000上运行express服务器
mobx-firebase-store, 在mobX映射中,存储firebase数据 mobx-firebase-storeMobxFirebaseStore 允许你通过 firebase-nest 订阅订阅firebase数据,并将数据流放入到 mobx 可以观察的映射中。见现场:故事 。要求的库...
前端项目-mobx-react,对mobx的绑定进行反应。创建完全反应的组件。
在微信小程序中使用mobx,mobx-wxapp简单的提供了一个observer函数
前端项目-mobx,简单、可扩展的状态管理。
mobx:状态管理库,可替代Redux
# Electron React MobX开发脚手架 基于最新版本的Electron、React和MobX,使用了Office Fabric UI组件,支持打包发布跨平台应用。 ## 如何使用 1. 安装 node modules ```bash yarn ``` 2. 启动 React ```bash yarn ...
react+mobx,react+mobxreact+mobxreact+mobxreact+mobxreact+mobxreact+mobxreact+mobxreact+mobxreact+mobxreact+mobxreact+mobxreact+mobx
安装使用npm安装pkg: npm install vue-mobx --save或纱线 yarn add vue-mobx或凉亭 bower install vue-mobx用法显然,它适用于Mobx和Vuejs,可通过NPM安装: npm i --save mobx vue vue-mobx :1.安装vue-mobx插件...
很不错的 MobX 相关资源整合。.zip,一组关于mobx的很棒的东西。
React进阶之路——MobX项目实战, MoBX知识结构与核心概念,组织项目结构
前端开源库-mobx-react-devtoolsmobx react dev tools,mobx和react的dev工具
mobx同步 一个库使用JSON通过版本控制来持久化您的MobX存储。 特征 使用JSON.stringify/JSON.parse作为反序列化/序列化方法 使用@version装饰器进行版本控制 通过使用@ignore装饰器忽略任何商店节点 支持React ...
mobx-vue MobX的Vue绑定,灵感来自安装npm i mobx-vue -S 要么yarn add mobx-vue需求Vue> = 2.0.0 MobX> = 2.0.0,与MobX 5兼容!为什么选择mobx-vue MobX是一种不受限制的,可扩展的状态管理,可以使我们的编程更加...
Mobx坚持 $ npm install mobx-persist --save 用法 import { observable } from 'mobx' import { create , persist } from 'mobx-persist' class SomeItem { @ persist @ observable name = 'some' @ persist @ ...
MobX记录器通过仅记录正确的信息,始终了解MobX应用程序中的实际情况。 ★★★喜欢这个项目吗? ,或以支持我的工作! 谢谢。 ★★★安装NPM: npm install mobx-logger CDN: ...
很不错的 MobX 相关资源整合
:smiling_face_with_heart-eyes:与umi一起使用mobx-state-tree 。 :sparkles:特征 自动使用状态树节点包装路线组件。 通过使用umi/dynamic支持动态导入状态树节点。 使用Mobx生态系统而不是Redux。 解析规则与umi-...