当前位置: 首页 > news >正文

四平做网站西安百度首页优化

四平做网站,西安百度首页优化,小程序开发公司如何寻找客户,从手机上可以做网站吗1 . vue异步组件技术 异步加载 vue-router配置路由 , 使用vue的异步组件技术 , 可以实现按需加载 . 但是,这种情况下一个组件生成一个js文件 /* vue异步组件技术 */ { path: /home, name: home, component: resolve > require([/components/home],resolve) }, { path…

1 . vue异步组件技术 ==== 异步加载 

vue-router配置路由 , 使用vue的异步组件技术 , 可以实现按需加载 . 

但是,这种情况下一个组件生成一个js文件

/* vue异步组件技术 */

{ path: '/home', name: 'home', component: resolve => require(['@/components/home'],resolve) },
{ path: '/index', name: 'Index', component: resolve => require(['@/components/index'],resolve) },
{ path: '/about', name: 'about', component: resolve => require(['@/components/about'],resolve) }

2.组件懒加载方案二 路由懒加载(使用import)

const 组件名=() => import('组件路径');
// 下面2行代码,没有指定webpackChunkName,每个组件打包成一个js文件。
/* const Home = () => import('@/components/home')
const Index = () => import('@/components/index')
const About = () => import('@/components/about') */
// 下面2行代码,指定了相同的webpackChunkName,会合并打包成一个js文件。
把组件按组分块
const Home = () => import(/* webpackChunkName: 'ImportFuncDemo' */ '@/components/home')
const Index = () => import(/* webpackChunkName: 'ImportFuncDemo' */ '@/components/index')
const About = () => import(/* webpackChunkName: 'ImportFuncDemo' */ '@/components/about'){ path: '/about', component: About }, { path: '/index', component: Index }, { path: '/home', component: Home }

3.webpack提供的require.ensure()  

vue-router配置路由,使用webpack的require.ensure技术,也可以实现按需加载。 
这种情况下,多个路由指定相同的chunkName,会合并打包成一个js文件。
/* 组件懒加载方案三: webpack提供的require.ensure() */
{ path: '/home', name: 'home', component: r => require.ensure([], () => r(require('@/components/home')), 'demo') },
{ path: '/index', name: 'Index', component: r => require.ensure([], () => r(require('@/components/index')), 'demo') },
{ path: '/about', name: 'about', component: r => require.ensure([], () => r(require('@/components/about')), 'demo-01') }// r就是resolve
const list = r => require.ensure([], () => r(require('../components/list/list')), 'list');
// 路由也是正常的写法  这种是官方推荐的写的 按模块划分懒加载 
const router = new Router({routes: [{path: '/list/blog',component: list,name: 'blog'}]
})

 

http://www.jinmujx.cn/news/117333.html

相关文章:

  • 摄影网站建设目的营销推广的工具有哪些
  • 海南e登录app网站seo关键词设置
  • 大型电商网站建设西安网约车平台
  • 策划网站建设学做网站培训班要多少钱
  • 做阀门销售在哪个网站上做好数据网站有哪些
  • 做emc的有哪些网站网络搜索工具
  • 网站建设需要哪些项目如何制作微信小程序店铺
  • 美国网站人肉收做在线培训系统app
  • 一键提交网站上海网站制作
  • 会用框架做网站能找到工作吗百度热搜的含义
  • 网站加载速度影响因素链网
  • 网站页面设计与实现各大网站提交入口
  • 哈尔滨做网站网络营销的特征
  • 校园网站制作模板网络小说排行榜
  • 乌克兰网站建设国外电商平台有哪些
  • 河北城乡建设和交通委员会网站广告投放
  • 选手机网站推广合作
  • 淘宝基地网站怎么做百度小说搜索热度排行榜
  • 政府网站建设申请报告个人怎么注册自己的网站
  • 商业网站策划书范文免费自学电商教程
  • 网站空间的存放种类今日国际新闻最新消息事件
  • 网站常见程序问题搜索引擎推广的费用
  • 重庆家政网站建设seoul什么意思
  • 廊坊做网站费用口碑营销策略
  • 中国网站建设集团北京seo课程
  • 傻瓜式网站模板网站排名优化软件联系方式
  • 网站建设的功能有哪些如何做好网站的推广工作
  • 做网站需要考虑哪些问题推广免费
  • 彩票推广网站如何做比较开放的浏览器
  • wordpress开户多站点武汉本地seo