创建私有工具类xiaozhi,添加get请求参数处理,吧对象转URL参数
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
export class XiaoZhi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象转URL参数
|
||||||
|
*/
|
||||||
|
static tansParams(params : UTSJSONObject) : string {
|
||||||
|
const json = params.toMap()
|
||||||
|
let result = ""
|
||||||
|
json.forEach((value, key) => {
|
||||||
|
if (result.length > 0) {
|
||||||
|
result += "&"
|
||||||
|
}
|
||||||
|
result += encodeURIComponent(key)
|
||||||
|
+ "="
|
||||||
|
+ encodeURIComponent(value.toString())
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user