Add basic Vue 3 compatibility

This commit is contained in:
Luke Underwood 2020-11-02 04:15:22 -08:00
parent 2f63eebb70
commit 44b7d7b234
2 changed files with 16 additions and 6 deletions

10
dist/vue-socketio.js vendored

File diff suppressed because one or more lines are too long

View file

@ -28,8 +28,16 @@ export default class VueSocketIO {
*/
install(Vue){
Vue.prototype.$socket = this.io;
Vue.prototype.$vueSocketIo = this;
const version = Number(Vue.version.split('.')[0])
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);
Logger.info('Vue-Socket.io plugin enabled');