antvis / antvis/F2

5.x 是否对uniapp支持

Open
#2,163 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
8k
Forks
637
PR merge metrics
No merged PRs in 30d

Description

官方文档并没有明确说明;我去chatGPT问了,他的回答:

F2 v5:❌ 不适合 / 不建议用于 uni-app 开发的微信小程序

不是“有点麻烦”,而是 架构层面不匹配。

如果你在做 uni-app + 微信小程序,F2 v5 不在推荐清单内。

一、F2 v5 的官方定位,已经“离开小程序”了

从 F2 v5 开始,AntV 做了一个非常明确的方向调整:

F2 v5 = 面向现代 Web(H5 / WebView / 框架)

不再以小程序为一等公民

官方文档与代码层面的信号非常明显:

核心渲染假设是:

window

document

标准 DOM / Canvas API

架构更偏向:

现代前端构建(ESM / Tree Shaking)

框架集成(React / Vue / Vanilla Web)

👉 而微信小程序(尤其是 uni-app 编译产物)不满足这些前提

二、F2 v5 在 uni-app + 微信小程序下的真实问题
❌ 1️⃣ Canvas 不兼容(致命)

F2 v5 默认使用的是 HTML5 Canvas + DOM 体系

而 uni-app → 微信小程序:

使用的是 小程序 canvas 组件

Canvas API 是 裁剪版

不是真正的 DOM Canvas

结果是:

初始化失败

或图表不渲染

或触控事件失效

⚠️ 这不是配置问题,是运行环境问题

❌ 2️⃣ 事件系统不通(交互废掉)

F2 v5 的交互模型假设:

Pointer / Mouse / Touch Event

连续事件流

高精度坐标映射

而小程序里:

事件被框架接管

坐标系被转换

事件频率被限制

👉 基金走势图这种“跟手拖动”在 uni-app 里几乎不可用

❌ 3️⃣ 打包直接踩雷

你会遇到这些问题之一:

window is not defined

document is not defined

tree-shaking 后丢模块

编译体积爆炸

原因很简单:

F2 v5 不是为 uni-app 的编译链设计的

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by checking the F2 v5 documentation and reproducing the reported behavior in a uni-app WeChat mini-program, focusing on canvas, event handling, and runtime assumptions. Done means the supported status and any limitations are verified and clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization, documentation, mobile
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.