vue cli工具UI,AXIOS开发流程

1: 安装UI库使用element-ui组件

  npm install element-ui -s

2: 安装异步请求AXIOS库

  npm install -s axios

3: 工程中增加vue.config.js 文件,配置端口,服务器以及代理相关

module.exports = {
    devServer: {
        port: 20110, // 端口号,如果端口号被占用,会自动提升1
        host: "localhost", //主机名, 127.0.0.1,  真机 0.0.0.0
        https: true,     //协议
        open: true,     //启动服务时自动打开浏览器访问
        proxy: {
            '/hzhxapi': {
                target: 'http://www.xxxx.com:20089',
                changeOrigin: true,
                pathRewrite: {
                    '^/hzhxapi': ''
                }
            },
            '/wixapi': {
                target: 'https://www.leasing.com',
                changeOrigin: true,
                pathRewrite: {
                    '^/wixapi': ''
                }
            }
        }
    },

    lintOnSave: false, // 关闭格式检查
    productionSourceMap: false, // 打包时不会生成 .map 文件,加快打包速度 
}

 4:  运行web命令

npm run serve

  

posted @ 2020-03-16 09:46  _成飞  阅读(270)  评论(0编辑  收藏  举报