Skip to content

Commit

Permalink
feat: use global api to register components
Browse files Browse the repository at this point in the history
In the vue 3 api, install expects an instance of the createApp return
value. This commit imports the created app and defines it as the type
for the app argument for the install function. Lastly, vue no longer
exports Vue, but rather has you registers components on an existing app.
This commit uses the new global component registration api.
  • Loading branch information
luqven committed Jul 8, 2021
1 parent 7b4dd29 commit eb7e1ad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plugins/vue-imgix/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import _Vue from 'vue';
import { app } from '@/main'
import { IxPicture } from './ix-picture';
import { IxSource } from './ix-source';
import { IVueUseImgixOptions } from './types';
import { initVueImgix, IxImg } from './vue-imgix';

// Declare install function executed by Vue.use()
export function install(Vue: typeof _Vue, options: IVueUseImgixOptions) {
export function install(_app: typeof app, options: IVueUseImgixOptions) {
if (install.installed) return;
install.installed = true;
initVueImgix(options);
Vue.component('ix-img', IxImg);
Vue.component('ix-picture', IxPicture);
Vue.component('ix-source', IxSource);
_app.component('ix-img', IxImg);
_app.component('ix-picture', IxPicture);
_app.component('ix-source', IxSource);
}
install.installed = false;

Expand Down

0 comments on commit eb7e1ad

Please sign in to comment.