vue跨域访问servlet问题
1、vue访问servlet问题
创建vue.config.js并添加
module.exports = { devServer: { proxy: { '/vue_web': { target: 'http://localhost:8888' } } } } 2、servlet相应数据vue的axios接收不到response.setHeader("Access-Control-Allow-Origin", "*");
3、请求携带参数servlet接收不到(post)
import qs from 'qs'
const { data: res } = await this.$http.post('/vue_web/brandServlet', qs.stringify(this.seachInfo))====》qs.stringify(要携带的参数)==x&y&z...
JSON.stringify(参数)====>以json方式传递