{"action":"closed","issue":{"url":"https://api.github.com/repos/yyx990803/vue/issues/1162","labels_url":"https://api.github.com/repos/yyx990803/vue/issues/1162/labels{/name}","comments_url":"https://api.github.com/repos/yyx990803/vue/issues/1162/comments","events_url":"https://api.github.com/repos/yyx990803/vue/issues/1162/events","html_url":"https://github.com/yyx990803/vue/issues/1162","id":101151301,"number":1162,"title":"Computed properties calculation results are inconsistent","user":{"login":"fychinesepjj126","id":9473134,"avatar_url":"https://avatars.githubusercontent.com/u/9473134?v=3","gravatar_id":"","url":"https://api.github.com/users/fychinesepjj126","html_url":"https://github.com/fychinesepjj126","followers_url":"https://api.github.com/users/fychinesepjj126/followers","following_url":"https://api.github.com/users/fychinesepjj126/following{/other_user}","gists_url":"https://api.github.com/users/fychinesepjj126/gists{/gist_id}","starred_url":"https://api.github.com/users/fychinesepjj126/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fychinesepjj126/subscriptions","organizations_url":"https://api.github.com/users/fychinesepjj126/orgs","repos_url":"https://api.github.com/users/fychinesepjj126/repos","events_url":"https://api.github.com/users/fychinesepjj126/events{/privacy}","received_events_url":"https://api.github.com/users/fychinesepjj126/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-15T08:12:26Z","updated_at":"2015-08-15T18:31:55Z","closed_at":"2015-08-15T18:31:55Z","body":"### Different code sequence have different computed result \r\n*  Is the problem caused by the cache ?\r\n* Suggest having a switch to control the cache\r\n\r\n***we want the result is example 1***\r\nexample  1 , console.log results:\r\n0------old data\r\n1------new data\r\n\r\nexample 2 , console.log results:\r\n0------old data\r\n1------old data\r\n1------new data\r\n\r\n\r\n``` html\r\n<div id=\"demo\">\r\n    <button v-on=\"click:readContent\">read</button>\r\n    <test-content content=\"{{content}}\" v-ref=\"test\"  inline-template>\r\n        <div>  {{ detailContent }}</div>\r\n    </test-content>\r\n</div>\r\n```\r\n\r\n\r\nExample  1:  the results we want\r\n``` javascript\r\nVue.config.debug =true;\r\nvue = new Vue({\r\n    el: '#demo',\r\n    data: {\r\n        content: 'old data'\r\n    },\r\n\tmethods:{\r\n    \treadContent: function(){\r\n            var self = this;\r\n            \r\n           setTimeout(function(){\r\n                self.content = 'new data'; // set new content\r\n                self.$.test.index = 1;   // set new index\r\n            },2000);\r\n        }\r\n    },\r\n    components: {\r\n    \t'test-content': {\r\n            props:['content'],\r\n        \tdata: function(){\r\n                return {\r\n                    index: 0\r\n                }\r\n            },\r\n            computed: {\r\n            \tdetailContent: function(){\r\n                \tvar tmp = this.index + '------' + this.content;\r\n                    console.log(tmp);\r\n                    return tmp;\r\n                }\r\n            }\r\n        }\r\n    }\r\n})\r\n```\r\nexample  2:\r\n``` javascript\r\nVue.config.debug =true;\r\nvue = new Vue({\r\n    el: '#demo',\r\n    data: {\r\n        content: 'old data'\r\n    },\r\n\tmethods:{\r\n    \treadContent: function(){\r\n            var self = this;\r\n            \r\n           setTimeout(function(){\r\n                self.$.test.index = 1;         // The code sequence is different \r\n                self.content = 'new data'; \r\n            },2000);\r\n        }\r\n    },\r\n    components: {\r\n    \t'test-content': {\r\n            props:['content'],\r\n        \tdata: function(){\r\n                return {\r\n                    index: 0\r\n                }\r\n            },\r\n            computed: {\r\n            \tdetailContent: function(){\r\n                \tvar tmp = this.index + '------' + this.content;\r\n                    console.log(tmp);\r\n                    return tmp;\r\n                }\r\n            }\r\n        }\r\n    }\r\n})\r\n```\r\n"}}