mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
fix(mixin): mixin support
This commit is contained in:
parent
1678253d93
commit
e1e444c7df
3 changed files with 7 additions and 5 deletions
2
dist/vue-socketio.js
vendored
2
dist/vue-socketio.js
vendored
File diff suppressed because one or more lines are too long
|
@ -33,12 +33,14 @@ export default class VueSocketIO {
|
|||
if (version >= 3) {
|
||||
Vue.config.globalProperties.$socket = this.io;
|
||||
Vue.config.globalProperties.$vueSocketIo = this;
|
||||
Vue.mixin(Mixin(true));
|
||||
|
||||
} else {
|
||||
Vue.prototype.$socket = this.io;
|
||||
Vue.prototype.$vueSocketIo = this;
|
||||
Vue.mixin(Mixin(false));
|
||||
}
|
||||
|
||||
Vue.mixin(Mixin);
|
||||
|
||||
Logger.info('Vue-Socket.io plugin enabled');
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default {
|
||||
export default (isVue3) => ({
|
||||
|
||||
/**
|
||||
* Assign runtime callbacks
|
||||
|
@ -39,7 +39,7 @@ export default {
|
|||
/**
|
||||
* unsubscribe when component unmounting
|
||||
*/
|
||||
beforeUnmount(){
|
||||
[isVue3 ? 'beforeUnmount' : 'beforeDestroy'](){
|
||||
|
||||
if(this.$options.sockets){
|
||||
|
||||
|
@ -53,4 +53,4 @@ export default {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
})
|
Loading…
Add table
Reference in a new issue