前端向后台发送json串

  // 每次上传气体警告之前先将数据转成json
          this.gasLevelSettingJson = JSON.stringify(this.gasLevelSetting)
          console.log(this.gasLevelSettingJson)

提交时候使用encodeURIComponent(jsonStr, ‘utf-8’)方法

// 保存设置--气体警告等级
export function saveGasLevelSetting(jsonStr) {
  return request({
    url: '/rangSetting/updateRangIdByLevelId?jsonStr=' + encodeURIComponent(jsonStr, 'utf-8'),
    method: 'put',
    data: jsonStr
  })
}

猜你喜欢

转载自blog.csdn.net/weixin_43254676/article/details/86612318