Uppy 支持 IE11
我们官方正式支持最新版本的 Chrome
、Firefox
、Safari
和 Edge
浏览器。
Internet Explorer
并未获得官方支持,即我们不对它进行测试,但只要使用了正确的 polyfills
(兼容性补丁),你可以较为确信其能正常工作。然而,使用 IE11
仍存在样式或功能方面产生意外结果的风险。
Polyfills(兼容性补丁)
- npm
npm install core-js whatwg-fetch abortcontroller-polyfill md-gum-polyfill resize-observer-polyfill
- yarn
yarn add core-js whatwg-fetch abortcontroller-polyfill md-gum-polyfill resize-observer-polyfill
import "core-js";
import "whatwg-fetch";
import "abortcontroller-polyfill/dist/polyfill-patch-fetch";
// Order matters: AbortController needs fetch which needs Promise (provided by core-js).
import "md-gum-polyfill";
import ResizeObserver from "resize-observer-polyfill";
window.ResizeObserver ??= ResizeObserver;
export { default } from "@uppy/core";
export * from "@uppy/core";
传统 CDN 捆绑包
谨慎
此捆绑包包含大部分 Uppy
插件,因此不建议在生产环境中使用此方法,因为尽管您可能仅使用少数几个插件,但用户却需要下载所有插件。
但它在加速开发环境方面很有帮助,所以在开始阶段请毫不犹豫地使用它来提速。
<!-- 1. Add CSS to `<head>` -->
<link href="https://releases.transloadit.com/uppy/v3.27.3/uppy.min.css" rel="stylesheet">
<!-- 2. Initialize -->
<div id="uppy"></div>
<script type="module">
import { Uppy, DragDrop, Tus } from "https://releases.transloadit.com/uppy/v3.27.3/uppy.legacy.min.js"
const uppy = new Uppy()
uppy.use(DragDrop, { target: '#uppy' })
uppy.use(Tus, { endpoint: '//tusd.tusdemo.net/files/' })
</script>