防止get请求参数值为false或0等特殊值会导致无法正确的传参

Merge pull request !146 from wugh/hotfix/gitee-issue_I2A5FU
This commit is contained in:
若依 2020-12-22 16:19:51 +08:00 committed by Gitee
commit 1a87ee7c19
1 changed files with 103 additions and 103 deletions

View File

@ -25,7 +25,7 @@ service.interceptors.request.use(config => {
for (const propName of Object.keys(config.params)) { for (const propName of Object.keys(config.params)) {
const value = config.params[propName]; const value = config.params[propName];
var part = encodeURIComponent(propName) + "="; var part = encodeURIComponent(propName) + "=";
if (value && typeof(value) !== "undefined") { if (value !== null && typeof(value) !== "undefined") {
if (typeof value === 'object') { if (typeof value === 'object') {
for (const key of Object.keys(value)) { for (const key of Object.keys(value)) {
let params = propName + '[' + key + ']'; let params = propName + '[' + key + ']';