vue nuxt生成静态页面

Posted fm060

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue nuxt生成静态页面相关的知识,希望对你有一定的参考价值。

npm install -g vue-cli   //安装vue-cli架子

vue init nuxt-community/starter-template <project-name> //安装nuxt

npm run dev //开发运行, http://localhost:3000

 

如果需要生产静态文件使用命令:npm run generate

 

 

nuxt.config.js的一些配置

 

head: {
    script: [
      { src: ‘/‘ }/*外部js的引入,或者static中的js文件引入(/**.js)*/
    ]
  },
  env: {
    url: ‘http://***.com‘ /*全局asyncData({env})的配置,比如请求头URL常量*/
  },
  /*代理IP的使用*/
  proxy: [ [‘/api‘, {target: ‘http://**.com‘}] ], 
  build: {
    vendor: [‘axios‘, ‘qs‘],/*多个地方引用,防止多次打包*/
    }
  }

  

以上是关于vue nuxt生成静态页面的主要内容,如果未能解决你的问题,请参考以下文章