我有一个服务,我在其中调用 API URL,并且我的 URL 应该".."在我的值周围有引号,但它打印起来就像%22%27我调用 API 时一样,如何在我的 URL 中使用双引号?代码return this.http
.get(`${this.env.HELPDESK_LIST_FILTER}` + '[{ "value": ' + `'"${value}"'` + ', "field": ' + `'"${column}"'` + ', "sort": ' + `'"${sort}"'` + ', "op": ' + `'"${filter}"'` + ' }]', params)
.pipe(map((data) => data));我的最终 URL 应该是这样的:https://example.com/api/tickets?filters=[{"value":"una","field":"name","sort":"none","op":"like"}]相反,现在是这样的:https://example.com/api/tickets?filters=[{%20%22value%22:%20%27%22una%22%27,%20%22field%22:%20%27%22name%22%27,%20%22sort%22:%20%27%22none%22%27,%20%22op%22:%20%27%22like%22%27%20}]任何想法?
1 回答
森林海
TA贡献2011条经验 获得超2个赞
尝试这个:
return this.http
.get(`${this.env.HELPDESK_LIST_FILTER}[{ "value": "${value}", "field": "${column}", "sort": "${sort}", "op": "${filter}" }]`, params)
.pipe(map((data) => data));
添加回答
举报
0/150
提交
取消