兼容性支持
April 19, 2023 · View on GitHub
Zarm 实现过程中,部分组件使用了较新的 API,这些 API 在低版本浏览器中可能会有兼容问题,导致运行代码逻辑执行失败或者报错。
本文档将公开 Zarm 中涉及到的兼容性不足的 API 的使用,帮助开发者根据项目实际场景选择是否需要添加相关的 polyfill。
API 使用情况列表
| 使用到的 API | 涉及组件 | 引入方式 | 最低兼容版本 | 推荐的 polyfill |
|---|---|---|---|---|
| IntersectionObserver | useInViewport | 直接使用 | Android 5 iOS 12.2 | intersection-observer |
| ResizeObserver | Picker PickerView Select DatePicker DatePickerView DateSelect | 直接使用 | Android 5 iOS 13.4 | resize-observer-polyfill |
| const | BackTop Carousel Pull Rate Slider SwiperAction | @use-gesture/react 依赖项 | Android 5 iOS 11 | babel |
| Arrow functions | BackTop Carousel Pull Rate Slider SwiperAction | @use-gesture/react 依赖项 | Android 5 iOS 10 | babel |