突发了一个奇怪的问题,原来是没有的

在manifest.json是有配置支持转发的

"devServer" : {
            "port" : 90, //端口号
            "disableHostCheck" : true,
            "proxy" : {
                "/prod-api" : {
                    "target" : "http://localhost:8088", // 本地ip
                    "changeOrigin" : true, //是否跨域
                    "secure" : false, // 设置支持https协议的代理
                    "pathRewrite" : {
                        "^/prod-api" : ""
                    }
                }
            }
        },

但是有的接口就没问题,有接口就提示

本站点必须要开启JavaScript才能运行

怎么解决的

http.setConfig((config) => { 
	config.baseUrl = interfaceList.api.baseUrl; /* 根域名不同 */
	// #ifdef H5
	    config.baseUrl = interfaceList.api.h5Sign; /* 根域名不同 */
	// #endif
	config.header = {
		'Cache-control': 'no-cache, no-store, must-revalidate',
		Timestamp: new Date().getTime(),
		timeout: 10000 //超时设置为10s
	}
	return config
})

核心代码

'Cache-control': 'no-cache, no-store, must-revalidate',

更多推荐