Understanding of lazy loading of vue routing

there is not much lazy loading and writing in official documents, the overall meaning is that the asynchronous components of Vue are combined with the code segmentation function of Webpack, so write

like this.
const Lanthree=()=>import(/* webpackChunkName: "Lanthree" */ "./vue/lanthree.vue")
Does

realize lazy loading? The introduced vue components are as follows

<template>
<div>

</div>
</template>
export default{
    name:"lanthree"
}

creates the Promise? through the introduction statement above Did you return Promise.resolve ({/ component definition object /})? Although the pages in the document are implemented, there is still no deep understanding of lazy loading. Is it possible to load the component only when the component is loaded?

Mar.09,2021

Yes. Promise is provided by the () = > import () syntax. As for using this logic to load js files, webpack/babel currently does this part of the work for you.

Menu