{"action":"created","issue":{"url":"https://api.github.com/repos/yyx990803/vue/issues/1055","labels_url":"https://api.github.com/repos/yyx990803/vue/issues/1055/labels{/name}","comments_url":"https://api.github.com/repos/yyx990803/vue/issues/1055/comments","events_url":"https://api.github.com/repos/yyx990803/vue/issues/1055/events","html_url":"https://github.com/yyx990803/vue/issues/1055","id":95391582,"number":1055,"title":"百度地图对象赋值给组件Data报错","user":{"login":"liyunfang","id":3365344,"avatar_url":"https://avatars.githubusercontent.com/u/3365344?v=3","gravatar_id":"","url":"https://api.github.com/users/liyunfang","html_url":"https://github.com/liyunfang","followers_url":"https://api.github.com/users/liyunfang/followers","following_url":"https://api.github.com/users/liyunfang/following{/other_user}","gists_url":"https://api.github.com/users/liyunfang/gists{/gist_id}","starred_url":"https://api.github.com/users/liyunfang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liyunfang/subscriptions","organizations_url":"https://api.github.com/users/liyunfang/orgs","repos_url":"https://api.github.com/users/liyunfang/repos","events_url":"https://api.github.com/users/liyunfang/events{/privacy}","received_events_url":"https://api.github.com/users/liyunfang/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-16T09:30:03Z","updated_at":"2015-07-16T10:40:40Z","closed_at":"2015-07-16T10:33:41Z","body":"data: function () {\r\n    return {\r\n        zoom  : 11,\r\n        center : null,\r\n        class : null,\r\n        bmap: null\r\n    }\r\n  },\r\n\r\nmap是实例化后的百度地图对象\r\nthis.bmap = map;\r\n错误：Uncaught TypeError: Cannot redefine property\r\n\r\n赋其他值不报错。"},"comment":{"url":"https://api.github.com/repos/yyx990803/vue/issues/comments/121922967","html_url":"https://github.com/yyx990803/vue/issues/1055#issuecomment-121922967","issue_url":"https://api.github.com/repos/yyx990803/vue/issues/1055","id":121922967,"user":{"login":"butsalt","id":8847427,"avatar_url":"https://avatars.githubusercontent.com/u/8847427?v=3","gravatar_id":"","url":"https://api.github.com/users/butsalt","html_url":"https://github.com/butsalt","followers_url":"https://api.github.com/users/butsalt/followers","following_url":"https://api.github.com/users/butsalt/following{/other_user}","gists_url":"https://api.github.com/users/butsalt/gists{/gist_id}","starred_url":"https://api.github.com/users/butsalt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/butsalt/subscriptions","organizations_url":"https://api.github.com/users/butsalt/orgs","repos_url":"https://api.github.com/users/butsalt/repos","events_url":"https://api.github.com/users/butsalt/events{/privacy}","received_events_url":"https://api.github.com/users/butsalt/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T10:40:40Z","updated_at":"2015-07-16T10:40:40Z","body":"Vue会通过`defineProperty`对传入Vue实例的数据的每个属性重新进行定义(如果这个属性的类型为Object，还会对这个属性对应的值的每个属性继续重新进行定义)，从而实现对属性的监听效果。你遇到的问题我觉得应该是map对象内部有无法进行再定义的属性(或子属性)。就像[这个例子](http://jsfiddle.net/5sH6A/128/)中显示的那样。如果这个map实例只是本组件内部使用的话，可以使用`$`,`_`作为属性前缀，那么Vue在进行重新定义时会跳过这些属性。但需要注意的是当你需要使用这个属性的时候你不能再使用类似`this.bmap`的方式进行获取，而应该改用`this.$data._map`的方式进行获取。并且这个属性的值发生变化时，Vue也不会对其进行监听。[这是一个范例](http://jsfiddle.net/5sH6A/129/)。或许最好的方式是Vue在对属性进行重新定义时，使用`Object.getOwnPropertyDescriptor`.实际上我现在有想过用Vue+Openlayers3做一个数据绑定的地图组件。我会在父组件中创建一个Map实例，并把这个实例采用`props`的方式传递给子组件。子组件会在创建时创建一层Layer用来展示它所关心的数据，并把这个Layer装入到Map中。子组件会在销毁时，将自己的Layer从Map中移除。"}}