美文网首页nuxt
nuxt.config.js

nuxt.config.js

作者: 他大舅啊 | 来源:发表于2019-06-24 13:54 被阅读0次

axios

axios: {
    proxy: true,
    headers: {
      'Content-Type':'application/x-www-form-urlencoded'
    },
    // 超时设置
    timeout: 10000,
    retry: { retries: 3 },           //自动拦截失败的请求 重试次数
  },
 // 代理服务器
  proxy: {
    '/api': 'http://xhs.cn/',
  },

端口

server: {
    port: 3001,
  }

build 打包

build: {
    extractCSS: { allChunks: true },
    vendor: ['axios'],
    extend(config, ctx) {
    },
    base: '/website',               //打包路径
    publicPath: '/website/',     //文件路径
  },

router

base 应用的根URL。举个例子,如果整个单页面应用的所有资源可以通过 /app/ 来访问,那么 base 配置项的值需要设置为 '/app/'。

router:{
    middleware:'headers',
    base: '/website/',         //修改router根路径
    //扩展路由(添加自定义路由)
    extendRoutes (routes, resolve) {
      routes.push({
        name: 'home',
        path: '/index',
        component: resolve(__dirname, 'pages/index.vue')
      })
    }
  },

相关文章

网友评论

    本文标题:nuxt.config.js

    本文链接:https://www.haomeiwen.com/subject/hognqctx.html