{"action":"created","issue":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/725","labels_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/725/labels{/name}","comments_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/725/comments","events_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/725/events","html_url":"https://github.com/RubyLouvre/avalon/issues/725","id":59333392,"number":725,"title":"$watch 监控 object 类型属性有问题","user":{"login":"darklx","id":3222379,"avatar_url":"https://avatars.githubusercontent.com/u/3222379?v=3","gravatar_id":"","url":"https://api.github.com/users/darklx","html_url":"https://github.com/darklx","followers_url":"https://api.github.com/users/darklx/followers","following_url":"https://api.github.com/users/darklx/following{/other_user}","gists_url":"https://api.github.com/users/darklx/gists{/gist_id}","starred_url":"https://api.github.com/users/darklx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darklx/subscriptions","organizations_url":"https://api.github.com/users/darklx/orgs","repos_url":"https://api.github.com/users/darklx/repos","events_url":"https://api.github.com/users/darklx/events{/privacy}","received_events_url":"https://api.github.com/users/darklx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-28T08:52:49Z","updated_at":"2015-03-01T03:29:27Z","closed_at":null,"body":"$watch 监控 primitiveType 可以，但是如果是 {}、[] 类型则有问题，直接上代码：\r\n\r\nvar testVM = avalon.define(\"test\", function (vm) {\r\n    vm.primitiveType = 1;\r\n    vm.objectType1 = {};\r\n    vm.objectType2 = [];\r\n    vm.objectType3 = null;\r\n});\r\n\r\nsetTimeout(function () {\r\n    testVM.primitiveType = 2;\r\n    testVM.objectType1 = { xx: \"hehe\" };\r\n    testVM.objectType2 = [{}, {}];\r\n    testVM.objectType3 = [{}, {}];\r\n}, 1000);\r\n\r\ntestVM.$watch(\"primitiveType\", function (newValue) {\r\n    console.log(\"primitiveType $watch:\" + newValue);\r\n});\r\n\r\ntestVM.$watch(\"objectType1\", function (newValue) {\r\n    console.log(\"objectType1 $watch:\" + newValue);\r\n});\r\n\r\ntestVM.$watch(\"objectType2\", function (newValue) {\r\n    console.log(\"objectType2 $watch:\" + newValue);\r\n});\r\n\r\n\r\ntestVM.$watch(\"objectType3\", function (newValue) {\r\n    console.log(\"objectType3 $watch:\" + newValue);\r\n});\r\n\r\n\r\n实际输出：\r\nprimitiveType $watch:2\r\nobjectType3 $watch:[object Object],[object Object]\r\n\r\n这个问题已影响到了复杂情况下多个 View Model 之间相互通信了！希望老大能解决下 :-)\r\n\r\n版本：avalon.js 1.391 build in 2015.1.27 \r\n"},"comment":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/comments/76568938","html_url":"https://github.com/RubyLouvre/avalon/issues/725#issuecomment-76568938","issue_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/725","id":76568938,"user":{"login":"RubyLouvre","id":190846,"avatar_url":"https://avatars.githubusercontent.com/u/190846?v=3","gravatar_id":"","url":"https://api.github.com/users/RubyLouvre","html_url":"https://github.com/RubyLouvre","followers_url":"https://api.github.com/users/RubyLouvre/followers","following_url":"https://api.github.com/users/RubyLouvre/following{/other_user}","gists_url":"https://api.github.com/users/RubyLouvre/gists{/gist_id}","starred_url":"https://api.github.com/users/RubyLouvre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RubyLouvre/subscriptions","organizations_url":"https://api.github.com/users/RubyLouvre/orgs","repos_url":"https://api.github.com/users/RubyLouvre/repos","events_url":"https://api.github.com/users/RubyLouvre/events{/privacy}","received_events_url":"https://api.github.com/users/RubyLouvre/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T03:29:27Z","updated_at":"2015-03-01T03:29:27Z","body":"不能，这性能太差了\r\n"}}