Just getting started with Vue.js
I'm looking to register a local component following the instructions here:
https://v2.vuejs.org/v2/guide/components.html#Local-Registration
The catch is that I need to register the component to an existing Vue instance, not when creating a new instance like this:
const app = new Vue({
el: '#app'
});
app.component({
'my-component': {
template: '<div>A custom component!</div>'
}
});
I've attempted using Vue.extend for this, but it's not yielding the desired results.
Edit:
Reason behind this requirement:
I'm working on a third-party package that will contain this component. The framework where the package will be integrated already includes Vue.js and has a Vue instance. So, if I include my package's JS before the framework's JS, I get "Vue is undefined". If I include my package's JS after the framework's JS, I face component errors as it needs to be registered prior to Vue instantiation.