Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
obj={name:'value'};
每次更改对象(添加新属性,删除属性)和读取属性(炖另一个函数)时如何调用函数?
看看 KnockoutJS。这是一个非常强大的 MVVM 框架,您将受益于完全使用它来将模型与视图逻辑分离。但是您也可以仅将其用于此特定需求(如果 40kb 可满足您的需求)...如果您查看 observables,他们会做您想做的事:http: //knockoutjs.com/documentation/observables.html