我想通过上传简单文件在React应用程序中演示FilePond模块。我有CodePen示例:
https://codepen.io/rikschennink/pen/WXavEx
如果转到“设置”,然后转到“ JavaScript”选项卡,则可以在此CodePen项目上找到许多添加的“外部脚本/笔”。我的问题是如何将下面的JS文件重新写入React文件,以及如何确定要安装的依赖项?
/*
We want to preview images, so we need to register the Image Preview plugin
*/
FilePond.registerPlugin(
// encodes the file as base64 data
FilePondPluginFileEncode,
// validates the size of the file
FilePondPluginFileValidateSize,
// corrects mobile image orientation
FilePondPluginImageExifOrientation,
// previews dropped images
FilePondPluginImagePreview
);
// Select the file input and use create() to turn it into a pond
FilePond.create(
document.querySelector('input')
);