{"action":"created","issue":{"url":"https://api.github.com/repos/MeCKodo/vue-tutorial/issues/9","repository_url":"https://api.github.com/repos/MeCKodo/vue-tutorial","labels_url":"https://api.github.com/repos/MeCKodo/vue-tutorial/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/MeCKodo/vue-tutorial/issues/9/comments","events_url":"https://api.github.com/repos/MeCKodo/vue-tutorial/issues/9/events","html_url":"https://github.com/MeCKodo/vue-tutorial/pull/9","id":181866983,"number":9,"title":"migrate to vue.js 2.0","user":{"login":"mikelkl","id":11305095,"avatar_url":"https://avatars.githubusercontent.com/u/11305095?v=3","gravatar_id":"","url":"https://api.github.com/users/mikelkl","html_url":"https://github.com/mikelkl","followers_url":"https://api.github.com/users/mikelkl/followers","following_url":"https://api.github.com/users/mikelkl/following{/other_user}","gists_url":"https://api.github.com/users/mikelkl/gists{/gist_id}","starred_url":"https://api.github.com/users/mikelkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikelkl/subscriptions","organizations_url":"https://api.github.com/users/mikelkl/orgs","repos_url":"https://api.github.com/users/mikelkl/repos","events_url":"https://api.github.com/users/mikelkl/events{/privacy}","received_events_url":"https://api.github.com/users/mikelkl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-09T05:28:00Z","updated_at":"2016-10-09T13:32:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/MeCKodo/vue-tutorial/pulls/9","html_url":"https://github.com/MeCKodo/vue-tutorial/pull/9","diff_url":"https://github.com/MeCKodo/vue-tutorial/pull/9.diff","patch_url":"https://github.com/MeCKodo/vue-tutorial/pull/9.patch"},"body":"Hello，二哲，你的教程对我帮助很大，我真的非常非常感谢你的这篇教程。\r\n\r\n我使用的版本是新发布的vue.js 2.0，在我的学习的过程中，发现了很多API变化的地方，于是我将这个项目整体迁移到了2.0的版本，并向你提出建议，希望能采纳。\r\n\r\n下面简要的总结下改动的地方：\r\n\r\n## vue-router api发生变化\r\n\r\n`// src/main.js`\r\n\r\n设置路由的几个函数：\r\n```javascript\r\nrouter.map()\r\nrouter.redirect()\r\nrouter.start()\r\n```\r\n全部被创建`router`实例取代\r\n\r\n启动应用的方式：\r\n```javascript\r\nrouter.start(App, '#app')\r\n```\r\n被创建`Vue`实例取代\r\n\r\n`// src/App.vue`\r\n链接：\r\n```html\r\n<a v-link=\"'/home'\">首页</a>\r\n```\r\n改为了：\r\n```html\r\n<router-link to=\"/home\">首页</router-link>\r\n```\r\n官方说法这样改的好处是：\r\n`<router-link>` 比起写死的 `<a href=\"...\"> `会好一些，理由如下：\r\n- 无论是 HTML5 history 模式还是 hash 模式，它的表现行为一致，所以，当你要切换路由模式，或者在 IE9 降级使用 hash 模式，无须作任何变动。\r\n- 在 HTML5 history 模式下，`router-link` 会拦截点击事件，让浏览器不在重新加载页面。\r\n- 当你在 HTML5 history 模式下使用 base 选项之后，所有的 `to `属性都不需要写（基路径）了。\r\n\r\n## $dispatch的弃用\r\n`$dispatch`和`$broadcast`在vue.js 2.0已被启用，如今有2种解决方案\r\n\r\n- 通过一个中间的Vue实例`bus`使用`bus.$emit()`和`bus.$on()`传递`event`\r\n- vuex\r\n\r\n这里采用的是vuex，用`store`来存储组件间公用的数据结构\r\n更多内容请参考：http://vuex.vuejs.org/\r\n\r\n`// src/App.vue`\r\n`ready()`钩子已被取消，使用`mounted()`代替\r\n请参考：http://vuejs.org/api/#mounted\r\n\r\n`// src/LogTime.vue`\r\n`// TimeEntries.vue`\r\n将所有`event`中的内容封装到`store.mutations`中"},"comment":{"url":"https://api.github.com/repos/MeCKodo/vue-tutorial/issues/comments/252486590","html_url":"https://github.com/MeCKodo/vue-tutorial/pull/9#issuecomment-252486590","issue_url":"https://api.github.com/repos/MeCKodo/vue-tutorial/issues/9","id":252486590,"user":{"login":"mikelkl","id":11305095,"avatar_url":"https://avatars.githubusercontent.com/u/11305095?v=3","gravatar_id":"","url":"https://api.github.com/users/mikelkl","html_url":"https://github.com/mikelkl","followers_url":"https://api.github.com/users/mikelkl/followers","following_url":"https://api.github.com/users/mikelkl/following{/other_user}","gists_url":"https://api.github.com/users/mikelkl/gists{/gist_id}","starred_url":"https://api.github.com/users/mikelkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikelkl/subscriptions","organizations_url":"https://api.github.com/users/mikelkl/orgs","repos_url":"https://api.github.com/users/mikelkl/repos","events_url":"https://api.github.com/users/mikelkl/events{/privacy}","received_events_url":"https://api.github.com/users/mikelkl/received_events","type":"User","site_admin":false},"created_at":"2016-10-09T13:32:27Z","updated_at":"2016-10-09T13:32:27Z","body":"哪里哪里，你的教程给刚接触vue.js不久的我很多启发，感谢你愿意把这么好的教程分享给大家\r\n\r\n---\r\n\r\n其实主要就是src下面的东西和package.json里面的东西改了，其他的基本没动"}}
{"actor":{"display_login":"mikelkl"}}