this is Vue-Socket.io component
is used as follows:
var vm = new Vue({
sockets:{
connect: function(){
console.log("socket connected")
},
customEmit: function(val){
console.log("this method was fired by the socket server. eg: io.emit("customEmit", data)")
}
},
methods: {
clickButton: function(val){
// $socket is socket.io-client instance
this.$socket.emit("emit_method", val);
}
}
})
now I want to use this component through vue-class-component
.
import Vue from "vue"
import Component from "vue-class-component"
// @Component Vue
@Component({
//
template: "<button @click="onClick">Click!</button>"
})
export default class MyComponent extends Vue {
//
message: string = "Hello!"
//
onClick (): void {
window.alert(this.message)
}
}
how can I use it?