Vue Runtime create components-how does the webpack+vue initial page load multiple components?

problem description

I created two components such as the following:
/ / component A1
< template >

<div>
    <div id="a1"></div>
</div>

< / template >

/ / component a2
< template >

<div>
    <div id="a2"></div>
</div>

< / template >

/ / Home page code:
< body >

<div id="app"></div>   

< / body >

/ / vue instance
import Vue from "vue"
import A1 from". / a1.vue"
import a2 from". / a2.js"

var vm=new Vue ({

)
el:"-sharpapp",
data:{
},
render:c=> c(a1),
router,
store

})

at present, this way of writing can only render the component A1 to the page. I want to change how to render A1 / A2 together in the runtime, and get other ways to load it into the page. Can it be realized at runtime?

Apr.05,2021

normally refers to other components in the main entrance, controls the switching of components by routing, or uses dynamic components. You can search the vue official website, dynamic components and routing

.
Menu