diff --git a/README.md b/README.md index 51e7b09..05959da 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ vuex.mutationPrefix|String |`null`|Optional|Prefix for emitting server side vuex #### 🌈 Component Level Usage +
if you want listen socket events from component side, you have to add `sockets` object in Vue component, and every function will start listen events, depends on object key
+ ``` javascript new Vue({ sockets: { @@ -68,9 +70,9 @@ new Vue({ } }, methods: { - clickButton: function (val) { + clickButton: function (data) { // $socket is socket.io-client instance - this.$socket.emit('emit_method', val); + this.$socket.emit('emit_method', data); } } })