问题复现
前端请求:
company/queryFenByOrgNo?orgNo=5&qcNam=%D2%BB%C6%DA
qcNam = 一期
后端接收:
CompanyManagementController - 入参 orgNo=“5”,qcNam=һ��
问题解决方案
let httpUrl = this.http+'company/queryFenByOrgNo';const params = new URLSearchParams();params.append('qcNam', encodeURIComponent(qcNam));params.append('orgNo', orgNo);axios.get(httpUrl,{ params }).then(function (response) {console.log("列表查询出参=",response.data);that.options = response.data;}).catch(function (error) {});
使用如下代码转义后再请求,后端接收就没问题了
const params = new URLSearchParams();params.append('qcNam', encodeURIComponent(qcNam));params.append('orgNo', orgNo);