jeecgboot 不想请求page的时候自动加载请求了page,导致跨域请求和 Provisional headers are shown问题

response设置响应头,解决跨域请求问题,No Access-Control-Allow-Origin header is present on the requested resource

(5条消息)解决浏览器 Provisional headers are shown 无法向后台发送请求问题_qq_15801963的博客-CSDN博客blog.csdn.net

先来说自动请求了page问题.

页面中加了

mport {JeecgListMixin} from '@/mixins/JeecgListMixin'


export default {
    name: "ProductTypeModal",
    mixins: [JeecgListMixin],

这个里面混入了页面,create()里有loadData(arg)方法.

可以在自己的页面里重写这个方法.

或者去掉混入,自己写表单的提交.

跨域问题我是:

import axios from 'axios'
//加载数据
loadTable() {
    this.queryParam.pageNo = this.ipagination.current
    this.queryParam.pageSize = this.ipagination.pageSize
    var url = this.url.page
    let that = this          # 需要再axios方法外面
    axios.defaults.headers['Content-Type'] = 'application/json;charset=UTF-8';  //此处是增加的代码,设置请求头的类型
    axios.post(url, {
        appId: this.appId,
        pageNumber: this.ipagination.current,
        pageSize: this.ipagination.pageSize,
        name: this.queryParam.name,
        ...//自己的其他参数
    }).then(function (res) {
        console.log('商品类型查询table的结果 = ', res.data.records)
        if (res.data.records) {
            that.tableList = res.data.records       # axios里面要用that
            that.ipagination.total = parseInt(res.data.total)
        } else {
            that.tableList = [];
        }
    }).catch(function (error) {
        console.log(error);
    })
},

 

然后后端的跨域白名单里有localhost:5000端口,

把前端的端口改了一下

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值