简体   繁体   English

如何接收来自使用 p-fileUpload 的 url 属性指定的 API 的响应?

[英]how to receive the response of coming from the API specified with the url attribute of p-fileUpload?

I've got this control:我有这个控制:

<p-fileUpload url="http://localhost:8586/upload"
              (onUpload)="onUpload($event)"
              multiple="multiple">

The api at http://localhost:8586/upload returns {key:value} after the file is uploaded.上传文件后, http://localhost:8586/upload的 api 返回{key:value} How can I access this response of the api?如何访问 api 的此响应?

In the same component which the html belongs to, write the method to track the output event by the 'p-fileupload' component/library.在 html 所属的同一组件中,编写通过“p-fileupload”组件/库跟踪 output 事件的方法。

Example way would be -示例方法是 -

public onUpload(event): void {
  // access key value here. probably event.key
  const key = event.key;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何以编程方式在 P-fileupload primeng 中显示图像? - How can i display image in P-fileupload primeng programatically? 如何记录来自提取API的响应 - How to log the response coming from fetch api 如何在 NodeJS 中接收来自 API 的响应? - How to receive Response from API in NodeJS? 如何将来自 api 的响应转换为图像 - How can I convert the response coming from the api to image 如何用API端点的响应主体替换ap标签中的文本? - How to replace text in a p tag with the response body from an API endpoint? 如果响应不透明,如何从 url 获取数据。 模式:“no-cors”没有显示任何效果 - How to fetch the data from the url if the response coming is opaque. mode: "no-cors" is not showing any effect 如何使用来自谷歌表单响应电子表格的 url 链接将图片插入谷歌文档 - How to insert picture to google docs using the url link coming from google form response spreadsheet 如何在 React js 中使用 redux 来自 api 的 map 阵列响应。 - How to map array response coming from the api using redux in react js in react js.? 如何将参数传递给 API 请求 2,我从 API 响应 1 收到响应 - How do I pass a parameter to API request 2, which I receive from API response 1 in react 如何连接来自 API 的 JSON 响应中的键并在 VUE 组件中显示 - How to concatenate a key in JSON response coming from API and display in VUE component
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM