mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
readme changes
This commit is contained in:
parent
63235b346c
commit
b59f1a4a60
1 changed files with 4 additions and 2 deletions
|
@ -57,6 +57,8 @@ vuex.mutationPrefix|String |`null`|Optional|Prefix for emitting server side vuex
|
|||
|
||||
#### 🌈 Component Level Usage
|
||||
|
||||
<p>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</p>
|
||||
|
||||
``` 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);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue