vue脚手架简单使用小记

在已经安装有node、npm环境的机器里,npm install -g vue-cli,寝化项目vue init webpack vuedemo
修改config/index.js文件的dev里的host,localhost => 0.0.0.0,这是因为项目是跑在虚拟机里的,使用localhost+port是访问不了的。
路由写成懒加载形式

routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: r => require(['@/components/HelloWorld'], r)
    },
    {
      path: '/test',
      name: 'test',
      component: r => require(['@/components/Test'], r)
    }
  ]

在build/build.js修改chunks: false => chunks: true,这样配置是为了实现懒加载文件

猜你喜欢

转载自blog.csdn.net/weixin_42233723/article/details/80783383
今日推荐