• axios接口跨域问题

1. 找到vue项目/config/index.js文件,在proxyTable里面添加代理,示例如下:   proxyTable: {      '/api':{         target: 'http://web.juhe.cn:8080',         changeOrigin: true,         ws: true,         pathRewrite: {           '^/api':'/'         }      }   }  // 注意:以后用api替换‘http://web.juhe.cn:8080’这个长的地址2. 在main.js 设置 axios.defaults.baseURL=”/api”   或是   axios.create({     baseURL: '/api', // api 的 base_url     timeout: 5000 // request timeout    })3. 接口请求处,直接更改就行了,示例如下:比如:之前的url为'http://web.juhe.cn:8080/constellation/getAll'直接改成url为'/constellation/getAll'
  • vue项目添加网站图标

1. 将icon放在与index.html同级的目录下2. 在webpack.dev.conf.js中,新增代码   const path = require('path')   new HtmlWebpackPlugin({      filename: 'index.html',      template: 'index.html',      inject: true,      favicon: path.resolve('favicon.ico')  // 新增   })3. 同样的在webpack.prod.conf.js中添加代码   favicon: path.resolve('favicon.ico'), //新增