vue引入组件import与require方式

2020-01-12 13:27
11191
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 09:16:40.0
I'm at Liverpool University <a href="http://99beers.com/tadacip-kosten">prix tadacip</a> This development is &lsquo;likely to be related to the closure of hostels that were used to accommodate most separated children prior to 2010'.
2020-10-25 09:16:39.0
Is there ? <a href="http://www.imengaged.org/speman-himalaya-kebaikan.html">speman himalaya malaysia</a> On Thursday night, two others, Christopher Simeone and Allan Kelly, told The New York Times that they -- not Krell -- had piloted Williams' helicopter, and that "they did not recall their convoy of helicopters coming under fire."
2020-10-25 09:16:39.0
I can't get a dialling tone <a href="http://freeresumetemplate.net/zenegra-100-side-effects.html">zenegra wikipedia</a> Goodell announced in August a stiffer penalty for players involved with domestic violence
2020-10-25 09:16:38.0
What company are you calling from? <a href="http://weightloss-basics.com/ranitidine-omeprazole-baby">warnings on prilosec</a> Jacintha Saldanha was found dead on 7 December 2012, three days after taking the call from two Australian radio DJs
2020-10-25 09:16:38.0
Photography <a href="http://99beers.com/caverta-50-mg-ranbaxy-side-effects">caverta de 50 mg</a> Photographers for the Catholic aid charity Cafod pictured people at three camps in central Darfur in 2007 and again in 2014 to find out how their lives have changed
2020-10-25 08:54:35.0
this post is fantastic <a href="http://www.flexss.co.uk/purchase-sulfasalazine-online/">sulfasalazine 500 mg tablet delayed release</a> I know you don&rsquo;t hear that every day but the best I have ever pitched is in that division (for Boston and Baltimore),&rdquo; Miller said
2020-10-25 08:54:34.0
Where's the postbox? <a href="http://prepa-sarcelles.fr/amiodarone-tablet-dosage.php">iv amiodarone filter</a> Sarah Brennan, chief executive of Young Minds, who will also sit on the task force said: "We can&#039;t have discussions about provision of services without talking about resources
2020-10-25 08:54:33.0
How many are there in a book? <a href="http://theformationquest.org/digoxin-furosemide.htm">lek digoxin cena</a> LeAnn Rimes is seen here rocking a look that can only be described as festival chic
2020-10-25 08:54:33.0
What sort of music do you like? <a href="http://zhidan.org/careprost-eye-drops-lumigan-generic-bimatoprost">bimatoprost overnight no consult</a> The Nationals, maneuvering their rotation for the playoffs, will have Blake Treinen start the day game and lefty Gio Gonzalez start at night.
2020-10-25 08:54:32.0
Will I have to work on Saturdays? <a href="http://sarigalin.org/alcohol-paxil/">paxil and hypothyroid</a> Core Coke is a sugary confection blamed by much of the world &#8211; including the medical establishment &#8211; for making the UK (and other countries) a bunch of fatties