如何实现简单的 Uppy 文件上传器

huangapple go评论137阅读模式
英文:

how to implement simple uppy fileuploader

问题

  1. 这个简单的例子不能工作。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Uppy文件上传示例</title>
<link href="https://releases.transloadit.com/uppy/v3.7.0/uppy.min.css" rel="stylesheet">
</head>
<body>

  1. &lt;!-- 2. 初始化 --&gt;
  2. &lt;div id=&quot;uppy&quot;&gt;&lt;/div&gt;
  3. &lt;script type=&quot;module&quot;&gt;
  4. import { Uppy, DragDrop } from &quot;https://releases.transloadit.com/uppy/v3.7.0/uppy.min.js&quot;
  5. const uppy = new Uppy()
  6. uppy.use(DragDrop, { target: &#39;#uppy&#39; })
  7. &lt;/script&gt;

</body>
</html>

Uncaught SyntaxError SyntaxError: 请求的模块 'https://releases.transloadit.com/uppy/v3.7.0/uppy.min.js' 未提供名为 'DragDrop' 的导出项
at (program) (c:\Users\belos\source\repos\testUppy\index.html:14:22)

  1. 我尝试过更改名称并查看文档,但它不起作用,我没有找到任何解决方案。
英文:

this simple example does not work.

  1. &lt;!DOCTYPE html&gt;
  2. &lt;html lang=&quot;en&quot;&gt;
  3. &lt;head&gt;
  4. &lt;meta charset=&quot;UTF-8&quot;&gt;
  5. &lt;title&gt;Uppy File Uploader Example&lt;/title&gt;
  6. &lt;link href=&quot;https://releases.transloadit.com/uppy/v3.7.0/uppy.min.css&quot; rel=&quot;stylesheet&quot;&gt;
  7. &lt;/head&gt;
  8. &lt;body&gt;
  9. &lt;!-- 2. Initialize --&gt;
  10. &lt;div id=&quot;uppy&quot;&gt;&lt;/div&gt;
  11. &lt;script type=&quot;module&quot;&gt;
  12. import { Uppy, DragDrop } from &quot;https://releases.transloadit.com/uppy/v3.7.0/uppy.min.js&quot;
  13. const uppy = new Uppy()
  14. uppy.use(DragDrop, { target: &#39;#uppy&#39; })
  15. &lt;/script&gt;
  16. &lt;/body&gt;
  17. &lt;/html&gt;
  1. Uncaught SyntaxError SyntaxError: The requested module &#39;https://releases.transloadit.com/uppy/v3.7.0/uppy.min.js&#39; does not provide an export named &#39;DragDrop&#39;
  2. at (program) (c:\Users\belos\source\repos\testUppy\index.html:14:22)

i tried to change names and check docs but it does not work i did not find any solution

答案1

得分: 0

我更改了链接,将文档中写的链接更改为这里的链接,这解决了我的问题。

英文:
  1. import {
  2. Uppy,
  3. Dashboard,
  4. Webcam,
  5. Tus,
  6. }
  7. from &quot;https://releases.transloadit.com/uppy/v3.10.0/uppy.min.mjs&quot;;

I changed link from which is writen in docs to link here and it solved my issue

huangapple
  • 本文由 发表于 2023年6月22日 19:13:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76531308.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定