-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
修改observer.add方法->解决对象新添加属性无法触发回调 #8
Comments
看到了。想法不错,赞一个。但是到底该不该触发需要从使用方再考虑一下~~ |
回头我升级一下~~ 多谢 |
@kmdjs 这个问题简单,可以再把add方法改造一下,加个参数判断一下是否要触发,让用户自己通过传参数选择是否触发就好了。 |
@sailengsi |
@kmdjs 好的。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
observe.add = function(obj, prop, value) { obj[prop] = null; var $observer = obj.$observer; $observer.watch(obj, prop); obj[prop] = value; }
这样改完,再使用observe.add(obj,newAttr,vlaue);就会在observe(obj,function(){})的回调中触发了。
The text was updated successfully, but these errors were encountered: