Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to globally remove a vue component from the global registry?

I would like to remove a components from Vue at runtime that was previously registered with Vue.component(name, {...}), is this possible ?

We are creating a number of components on the fly in a live development setting and would like to remove old components from memory.

Or is it possible to alter the child components registered with a component at runtime ? Only affecting new component instances built after that of course or refreshed manually.

like image 542
mgoetzke Avatar asked Oct 18 '22 07:10

mgoetzke


1 Answers

Currently in Vue 2.x, when you register a component with Vue.component it's added to the base constructor options object. You can unregister it by simply deleting the component from the components object:

Vue.component('child-component', ChildComponent)

delete Vue.options.components['child-component']
like image 57
Edward Avatar answered Oct 21 '22 00:10

Edward