Vue router routing introduction

const address = () => import("@/views/member/address")
 import Address from "page/member/address"

what is the difference between the above two ways of introduction

Jun.05,2021

an asynchronous Synchronize
the first is to execute the method to return a promise component to get
the second direct import component module


above is the asynchronous load route


.
const address = () => import('@/views/member/address')

is equivalent to

cost address = function(){
    return import('@/views/member/address')
}

he doesn't import it himself unless you execute address () .


the first one is asynchronous loading, and the second is the introduction of

by Synchronize.

the method of calling is also different

the first one needs address (). Then (add = > {/ * so use * /})

second normal use

Menu