antvis / antvis/F2

封装了F2的组件,想要通过改变id渲染不同的同一类型的图表,但是出现了问题

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

Description

如果我直接把id写死,是可以传值,但是我如果在子组件把id写成了变量,想通过父组件传入不同的id时,就会报错
Error in mounted hook: "TypeError: Cannot read property 'currentStyle' of null"

vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read property 'currentStyle' of null
at getStyle (f2.js?e004:750)

如果我封装组件的时候把id写成固定的就不会报错

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the wrapped F2 component with an id passed from the parent, then inspect the mounted hook and getStyle in f2.js around line 750. Done means charts of the same type render correctly with different ids without the currentStyle-of-null error, while a hard-coded id continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.