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

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

how to implement simple uppy fileuploader

问题

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

<!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>

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


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

this simple example does not work.

&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;UTF-8&quot;&gt;
  &lt;title&gt;Uppy File Uploader Example&lt;/title&gt;
  &lt;link href=&quot;https://releases.transloadit.com/uppy/v3.7.0/uppy.min.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;/head&gt;
&lt;body&gt;
    

    &lt;!-- 2. Initialize --&gt;
    &lt;div id=&quot;uppy&quot;&gt;&lt;/div&gt; 
    &lt;script type=&quot;module&quot;&gt;
      import { Uppy, DragDrop } from &quot;https://releases.transloadit.com/uppy/v3.7.0/uppy.min.js&quot;
      const uppy = new Uppy()
      uppy.use(DragDrop, { target: &#39;#uppy&#39; })
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
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;
    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

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

英文:
import {
    Uppy,
    Dashboard,
    Webcam,
    Tus,
} 
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:

确定