the components of vue are usually import, registered in components, and then can be used in the parent component, but now the component of the project is the component name obtained from the background, and then if else determines whether there is an import component, and finally generates it. Fortunately, there were only 4 components in 3Jing in the early stage, but then there were more and more. If else is getting longer and longer, and then I wonder if there is a way to register components dynamically. I read it on the official website and looked around on the Internet. Someone once wrote this
./**
*@desc */
registerComponent(templateName){
Vue.component(templateName, require("./../dashComponent/"+templateName+".vue"));
},
Registration scheme
this.registerComponent(this.layout[index].component);
dom
this should not be registered successfully, has any classmate encountered this kind of situation before?