Article From:

Echarts used in vue, if not used in the component is no problem, but in the component is a problem, solve the picture description

Answer 0:

Hello, is your ID wrong? I thought it was my screen.

Answer 1:

Hello, you first need to determine the data type of ids, if not String, Vue will convert it into a string, resulting in the DOM’s ID and you expect it to be different, you can not get the element.

You can add a ref to your score-line element.

<div class="score-line" style="width:100%;height:300px" ref="score"></div>

Then get the elements through ref.

let lineChart = this.$refs['score'];

Answer 2:

That ID is a string type when it comes in. You can get the DOM by the way you say, but you still can’t get the width of the dom. This is called in the parent component

Answer 3:

You should have chosen to switch to the card, when initialization of your page is hidden, then the div height is zero, so the style changes, the solution is

//Click on the switch or setOption to let its resize try once.Piechart = echarts.init (document.getElementById ('piechart'));SeTTimeout (function () {Piechart.Resize ();}, 0);

Leave a Reply

Your email address will not be published. Required fields are marked *