Add basic Vue 3 compatibility (#289)

pull/308/head
lju 3 years ago committed by GitHub
parent 2f63eebb70
commit 3337d43298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

File diff suppressed because one or more lines are too long

@ -28,8 +28,16 @@ export default class VueSocketIO {
*/ */
install(Vue){ install(Vue){
Vue.prototype.$socket = this.io; const version = Number(Vue.version.split('.')[0])
Vue.prototype.$vueSocketIo = this;
if (version >= 3) {
Vue.config.globalProperties.$socket = this.io;
Vue.config.globalProperties.$vueSocketIo = this;
} else {
Vue.prototype.$socket = this.io;
Vue.prototype.$vueSocketIo = this;
}
Vue.mixin(Mixin); Vue.mixin(Mixin);
Logger.info('Vue-Socket.io plugin enabled'); Logger.info('Vue-Socket.io plugin enabled');

Loading…
Cancel
Save