Invoking methods #642
Answered
by
Justineo
ramsesmoreno
asked this question in
Q&A
-
I would like to know if this is the correct way to invoke a Echart method using vue-echarts. I mean, to have access to the Echarts instance I have to use a reference to the VChart Element? This works, I want to be sure is the "correct" way. Thank you! <template>
<VChart class="chart" :option="option" :autoresize="true" @finished="onFinished" ref="chart" id="chart" />
{{ xPosition }}
</template>
<script setup lang="ts">
...
const option = ref({
...
});
const chart = ref(null as null | HTMLElement)
const xPosition = ref(0)
const onFinished = () => {
xPosition.value = chart.value.convertToPixel({xAxisIndex: 0}, 0c) + 'px'
}
...
</script> |
Beta Was this translation helpful? Give feedback.
Answered by
Justineo
Aug 12, 2022
Replies: 1 comment
-
I think this is correct. Methods are exposed on the component ref. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ramsesmoreno
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this is correct. Methods are exposed on the component ref.