vue引入组件import与require方式

2020-01-12 13:27
11206
31918

开发一个微信H5商城,路由配置如下: { path: '/home', name: 'home', meta: { name: '艾优购商城', title: '艾优购商城' }, component: resolve => require(['@/components/home'], resolve) }

对component:home和 component: resolve => require(['@/components/home'], resolve)配置方式的却别做如下记录: 准确来说是后者配置是为了懒加载: import:当项目打包时路由里的所有component(组件)都会打包在一个js中,造成进入首页时,需要加载的内容过多,时间相对比较长。 require:这种方式引入的时候,会将你的component(组件)分别打包成不同的js,加载的时候也是按需加载,只用访问这个路由网址时才会加载这个js。

全部评论

2020-10-25 12:13:54.0
Cool site goodluck :) <a href="http://cityweddings.co.uk/alesse-birth-control-generic-equivalent/">alesse for treatment of acne</a> Gregor Blanco&rsquo;s leadoff home run took a little steam out of the ballpark, but the Royals countered with a run in the first against Peavy, then scored another in the second to take the lead and get the crowd going again.
2020-10-25 12:13:53.0
A financial advisor <a href="http://homelinesport.co.il/product.php?prod=prix-duphalac-sachet">duphalac sirup cena</a> Shares in Eurasia, formed about 10 years ago mostly from thedrilling assets of Russia's second-largest oil producer Lukoil, jumped 68 percent to $20.45 per global depositaryreceipt after Tuesday's announcement.
2020-10-25 12:13:52.0
I didn't go to university <a href="http://www.reefonline.com.au/buy-zudena/anset">zydena 100 mg 4 film tablet fiyatı</a> In terms of camera quality Samsung galaxy Note 3 Neo equipped with an 8MP rear camera with Autofocus and LED flash which offers HDR, panorama, Geo- tagging, touch focus, face and smile detection
2020-10-25 12:13:52.0
Photography <a href="http://www.weekendcruise.co.uk/drug-protonix/">where to buy protonix cheap</a> forces pulled Somers and Korkie onto V-22 Ospreys, and medical teams began performing surgery in midair
2020-10-25 12:13:51.0
Where are you calling from? <a href="http://drandrewbrown.co.uk/buy-selegiline-online-uk.html">eldepryl side effects</a> China's shares ended down on Friday as investors remainedcautious ahead of September economic data due next week.Economists expect the Chinese economy to have grown at itsweakest pace in more than five years, according to a Reuterspoll.
2020-10-25 11:51:52.0
Looking for work <a href="http://vonjuliet.com.tr/sildalist-review">sildalist citrate</a> "This is why we are lagging behind in broadband and 4G(mobile broadband) compared to the U.S., South Korea and Japan,which have a much smaller number of players." (Additional reporting by Anjuli Davies in London and SophieSassard in Davos; Editing by Greg Mahlich)
2020-10-25 11:51:51.0
Do you like it here? <a href="http://cityweddings.co.uk/torsemide-side-effects/">torsemide vs furosemide in dogs</a> "Microsoft built their business on being very good at delivering what people needed in the moment, for example Excel in the 1990s," said Johnson at Forrester
2020-10-25 11:51:51.0
I've only just arrived <a href="http://cityweddings.co.uk/torsemide-side-effects/">inj torsemide brand names</a> While some studies have identified early life risk factors, most have not looked at the combined effects of these factors.
2020-10-25 11:51:50.0
I wanted to live abroad <a href="http://zobbing.co.uk/precio-computadoras-laptop-vit">tadora 20 use</a> But in the Victorian era they often attended educational institutions supported through philanthropic fundraising.
2020-10-25 11:51:50.0
I've only just arrived <a href="http://www.asiantbi.org/prevacid-dosage-60-mg">prevacid solu tabs</a> But Global Strategy said in a statement Friday, "it is our clear understanding that we are not a target of any investigation, and we are confident that all our work surpasses the highest legal and ethical standards."