文件上传完成后如何将 uploadcare 小部件重置为原始状态
how to reset uploadcare widget to original state after the file upload is complete
我正在使用 Uploadcare 小部件在 nodejs 应用程序中上传个人资料图片。
在 Uploadcare 小部件中,一旦用户上传完单个文件,我想返回到原始小部件状态,以便用户可以选择另一张图片来替换之前的图片。
widget.onUploadComplete(function(info) {
// assign image to image tag
$('#avatar').attr('src', info.cdnUrl);
// reset the widget to user can see the the "choose image" button again.
widget.value();
}
然而 widget.value() 似乎没有做任何事情,尽管在 issue on uploadcare
上建议这样做
widget.value
是 getter/setter 方法,所以 widget.value()
只是 return 当前值。
使用widget.value(null)
重置。
您可以在 Uploadcare JS 中找到更多信息 API documentation。
p.s.: 感谢提示,我已经改进了 github 问题中的答案。
我正在使用 Uploadcare 小部件在 nodejs 应用程序中上传个人资料图片。 在 Uploadcare 小部件中,一旦用户上传完单个文件,我想返回到原始小部件状态,以便用户可以选择另一张图片来替换之前的图片。
widget.onUploadComplete(function(info) {
// assign image to image tag
$('#avatar').attr('src', info.cdnUrl);
// reset the widget to user can see the the "choose image" button again.
widget.value();
}
然而 widget.value() 似乎没有做任何事情,尽管在 issue on uploadcare
上建议这样做widget.value
是 getter/setter 方法,所以 widget.value()
只是 return 当前值。
使用widget.value(null)
重置。
您可以在 Uploadcare JS 中找到更多信息 API documentation。
p.s.: 感谢提示,我已经改进了 github 问题中的答案。