{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vue/issues/2412","repository_url":"https://api.github.com/repos/vuejs/vue","labels_url":"https://api.github.com/repos/vuejs/vue/issues/2412/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue/issues/2412/comments","events_url":"https://api.github.com/repos/vuejs/vue/issues/2412/events","html_url":"https://github.com/vuejs/vue/issues/2412","id":137079935,"number":2412,"title":"vm.$dispatch does not stop propagation from a mixin","user":{"login":"andreixk","id":17452117,"avatar_url":"https://avatars.githubusercontent.com/u/17452117?v=3","gravatar_id":"","url":"https://api.github.com/users/andreixk","html_url":"https://github.com/andreixk","followers_url":"https://api.github.com/users/andreixk/followers","following_url":"https://api.github.com/users/andreixk/following{/other_user}","gists_url":"https://api.github.com/users/andreixk/gists{/gist_id}","starred_url":"https://api.github.com/users/andreixk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreixk/subscriptions","organizations_url":"https://api.github.com/users/andreixk/orgs","repos_url":"https://api.github.com/users/andreixk/repos","events_url":"https://api.github.com/users/andreixk/events{/privacy}","received_events_url":"https://api.github.com/users/andreixk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-28T18:26:42Z","updated_at":"2016-02-28T21:09:52Z","closed_at":"2016-02-28T21:09:52Z","body":"In the VueJS guide it says that by default $dispatch will stop propagating after it's caught the first time. \r\ni'm having trouble with this example:\r\n```html\r\n<div id='app'>\r\n\t<nav-c></nav-c>\r\n</div>\r\n```\r\n```javascript\r\nvar rtr = {\r\n\tdata:function() {return{rt:\"z\"} }\r\n\t,created:function() {\r\n\t\tvar self = this;\r\n\t\tsetTimeout(function() {\r\n\t\t\tconsole.log('start dispatch',self);\r\n\t\t\tself.$dispatch('chg',Math.random());\r\n\t\t},2000);\r\n\t}\r\n};\r\nVue.component('nav-c',{\r\n\ttemplate:'test'\r\n\t,mixins:[rtr]\r\n\t,events:{\r\n\t\t'chg':function(val) {\r\n\t\t\tconsole.log(val,'caught by nav-c');\r\n\t\t}\r\n\t}\r\n});\t\r\nvar app = new Vue({\r\n\tel:\"#app\"\r\n\t,mixins:[rtr]\r\n\t,events:{\r\n\t  'chg':function(val){\r\n\t\tconsole.log(val,\"caught by main app\");\r\n\t  }\r\n\t}\r\n});\r\n\r\n```\r\nsee [jsfiddle](https://jsfiddle.net/bjgsx0kw/1/)\r\n\r\nI understand here the 'chg' event is fired twice (once on nav-c and once on the main app). \r\nSo I should see two console logs as such:\r\n```\r\nstart dispatch Vue {...}\r\n0.6218637416604906 \"caught by main app\"\r\nstart dispatch NavC {...}\r\n0.33156903251074255 \"caught by nav-c\"\r\n```\r\nBut the result is this:\r\n```\r\nstart dispatch Vue {...}\r\n0.6218637416604906 \"caught by main app\"\r\nstart dispatch NavC {...}\r\n0.33156903251074255 \"caught by nav-c\"\r\n0.33156903251074255 \"caught by main app\"\r\n```\r\n\r\nI also tried adding `return false` to the nav-c event capture, no difference.\r\n\r\nCan someone explain if this isn't the right use of $dispatch or is this an actual bug?"},"comment":{"url":"https://api.github.com/repos/vuejs/vue/issues/comments/189946716","html_url":"https://github.com/vuejs/vue/issues/2412#issuecomment-189946716","issue_url":"https://api.github.com/repos/vuejs/vue/issues/2412","id":189946716,"user":{"login":"andreixk","id":17452117,"avatar_url":"https://avatars.githubusercontent.com/u/17452117?v=3","gravatar_id":"","url":"https://api.github.com/users/andreixk","html_url":"https://github.com/andreixk","followers_url":"https://api.github.com/users/andreixk/followers","following_url":"https://api.github.com/users/andreixk/following{/other_user}","gists_url":"https://api.github.com/users/andreixk/gists{/gist_id}","starred_url":"https://api.github.com/users/andreixk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreixk/subscriptions","organizations_url":"https://api.github.com/users/andreixk/orgs","repos_url":"https://api.github.com/users/andreixk/repos","events_url":"https://api.github.com/users/andreixk/events{/privacy}","received_events_url":"https://api.github.com/users/andreixk/received_events","type":"User","site_admin":false},"created_at":"2016-02-28T21:09:52Z","updated_at":"2016-02-28T21:09:52Z","body":"I just figured out that mixins aren't children of a component strictly speaking. So to produce desired behaviour I had to change $dispatch to $emit and everything works as expected."}}