{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vue/issues/1315","repository_url":"https://api.github.com/repos/vuejs/vue","labels_url":"https://api.github.com/repos/vuejs/vue/issues/1315/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue/issues/1315/comments","events_url":"https://api.github.com/repos/vuejs/vue/issues/1315/events","html_url":"https://github.com/vuejs/vue/issues/1315","id":106456473,"number":1315,"title":"Allow v-on to also work on custom events when used on child component","user":{"login":"yyx990803","id":499550,"avatar_url":"https://avatars.githubusercontent.com/u/499550?v=3","gravatar_id":"","url":"https://api.github.com/users/yyx990803","html_url":"https://github.com/yyx990803","followers_url":"https://api.github.com/users/yyx990803/followers","following_url":"https://api.github.com/users/yyx990803/following{/other_user}","gists_url":"https://api.github.com/users/yyx990803/gists{/gist_id}","starred_url":"https://api.github.com/users/yyx990803/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yyx990803/subscriptions","organizations_url":"https://api.github.com/users/yyx990803/orgs","repos_url":"https://api.github.com/users/yyx990803/repos","events_url":"https://api.github.com/users/yyx990803/events{/privacy}","received_events_url":"https://api.github.com/users/yyx990803/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/vuejs/vue/milestones/13","html_url":"https://github.com/vuejs/vue/milestones/1.0.0-alpha","labels_url":"https://api.github.com/repos/vuejs/vue/milestones/13/labels","id":1257572,"number":13,"title":"1.0.0-alpha","description":"","creator":{"login":"yyx990803","id":499550,"avatar_url":"https://avatars.githubusercontent.com/u/499550?v=3","gravatar_id":"","url":"https://api.github.com/users/yyx990803","html_url":"https://github.com/yyx990803","followers_url":"https://api.github.com/users/yyx990803/followers","following_url":"https://api.github.com/users/yyx990803/following{/other_user}","gists_url":"https://api.github.com/users/yyx990803/gists{/gist_id}","starred_url":"https://api.github.com/users/yyx990803/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yyx990803/subscriptions","organizations_url":"https://api.github.com/users/yyx990803/orgs","repos_url":"https://api.github.com/users/yyx990803/repos","events_url":"https://api.github.com/users/yyx990803/events{/privacy}","received_events_url":"https://api.github.com/users/yyx990803/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":17,"state":"closed","created_at":"2015-08-17T06:29:02Z","updated_at":"2015-11-06T20:30:27Z","due_on":null,"closed_at":"2015-11-06T20:30:27Z"},"comments":11,"created_at":"2015-09-15T01:06:59Z","updated_at":"2016-12-03T18:24:36Z","closed_at":"2015-09-17T00:51:07Z","body":"#### Problem\n\nCurrently the common practice for parent-child communication is passing down a method as a callback:\n\n``` html\n<comp :on-something=\"handleSomething\">\n</comp\n```\n\nBut this requires the child to declare a function prop, and calling a method on itself to communicate to the parent is not so intuitive:\n\n``` js\n// we need to either make \"onSomething\" a required prop,\n// or check its existence before calling it.\nif (this.onSomething) {\n  this.onSomething()\n}\n```\n\nA lot of times, it's nicer to have the loose coupling of real events:\n\n``` js\n// just this would be nice\nthis.$emit('something')\n```\n\nPreviously we had the `v-events` directive, which serves this exact purpose; I removed it in favor of the callback-prop pattern, partly because I felt the event system was problematic due to the issues outlined in #1175. But now the problem is somewhat mitigated with the solution proposed in #1175 (stop propagation by default), we can now reconsider the event pattern. If we bring back `v-events` with the new directive syntax, it would look like this:\n\n``` html\n<comp\n  v-events:update=\"handleUpdate\"\n  v-events:ready=\"onChildReady\">\n</comp>\n```\n\nWhich is not bad; but since we are already using `v-bind:` for both native attributes and props, why not just use `v-on` for both native and custom events?\n#### Proposal\n\nAllow `v-on` to listen for Vue custom events when used on a child component. In particular, **props** and **events** should constitute the public API of a component:\n- props for passing data down\n- events for handling actions up\n\nA typical component would look like this:\n\n``` html\n<comp\n  v-bind:prop-a=\"parentA\"\n  v-bind:prop-b=\"parentB\"\n  v-on:ready=\"onChildReady\"\n  v-on:update=\"onChildUpdate\">\n</comp>\n```\n\nWith shorthand:\n\n``` html\n<comp\n  :prop-a=\"parentA\"\n  :prop-b=\"parentB\"\n  @ready=\"onChildReady\"\n  @update=\"onChildUpdate\">\n</comp>\n```\n"},"comment":{"url":"https://api.github.com/repos/vuejs/vue/issues/comments/264656218","html_url":"https://github.com/vuejs/vue/issues/1315#issuecomment-264656218","issue_url":"https://api.github.com/repos/vuejs/vue/issues/1315","id":264656218,"user":{"login":"sai-prasanna","id":3595526,"avatar_url":"https://avatars.githubusercontent.com/u/3595526?v=3","gravatar_id":"","url":"https://api.github.com/users/sai-prasanna","html_url":"https://github.com/sai-prasanna","followers_url":"https://api.github.com/users/sai-prasanna/followers","following_url":"https://api.github.com/users/sai-prasanna/following{/other_user}","gists_url":"https://api.github.com/users/sai-prasanna/gists{/gist_id}","starred_url":"https://api.github.com/users/sai-prasanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sai-prasanna/subscriptions","organizations_url":"https://api.github.com/users/sai-prasanna/orgs","repos_url":"https://api.github.com/users/sai-prasanna/repos","events_url":"https://api.github.com/users/sai-prasanna/events{/privacy}","received_events_url":"https://api.github.com/users/sai-prasanna/received_events","type":"User","site_admin":false},"created_at":"2016-12-03T18:24:36Z","updated_at":"2016-12-03T18:24:36Z","body":"@yyx990803  what about something like props validation for events?"}}
{"actor":{"display_login":"sai-prasanna"}}