vue搭建——config.js+this.reload设置+封装请求接口

1、 config.js

module.exports = {
	  devServer: {
	            overlay: { // 让浏览器 overlay 同时显示警告和错误
	              warnings: true,
	              errors: true
	            },
	            host: "0.0.0.0",
	            port: 8080, // 端口号
	            https: false, // https:{type:Boolean}
	            open: false, //配置后自动启动浏览器
	            hotOnly: true, // 热更新
	            // proxy: 'http://localhost:8080'   // 配置跨域处理,只有一个代理
	            proxy: { //配置多个代理
	                "/shopweb": {
	                    target: "http://api.anyuanbl.com/",
											// target: "http://192.168.3.60:8086/",
	                    changeOrigin: true,
	                    ws: true,//websocket支持
	                    secure: false,
	                    pathRewrite: {
	                        "^/shopweb": "/"
	                    }
	                }
	            }
	        }
}

2、app.vue

<template&
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值