I'm new to Vue.js.
I want to register a local component as described over here:
https://v2.vuejs.org/v2/guide/components.html#Local-Registration
The only issue is that I need to register a component to an existing Vue instance not while creating a new instance something like:
const app = new Vue({
el: '#app'
});
app.component({
'my-component': {
template: '<div>A custom component!</div>'
}
});
I have tried Vue.extend for that, but it is not working.
Edit:
Why I need this:
I'm creating a 3rd party package which will have that component. The framework on which this package is going to be installed will already have Vue.js included and a Vue instance. So if I include my package's JS before framework's JS, then it will give me Vue is undefined and if I include my package's JS after framework's JS, then it will give me component error as it has to be registered before the Vue instantiation.