Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing the ref #131

Open
1 of 4 tasks
refjord opened this issue Jul 27, 2022 · 2 comments
Open
1 of 4 tasks

Accessing the ref #131

refjord opened this issue Jul 27, 2022 · 2 comments

Comments

@refjord
Copy link

refjord commented Jul 27, 2022

Describe the bug

A clear and concise description of what the bug is.

Hi guys,

I'm trying to access the ref using a setup as described in the docs:

<template>
	<LineChart ref="chart" :chartData="data" :options="options" />
</template>

<script lang="ts">
import { defineComponent, ref, onMounted } from "vue";
import { LineChart } from "vue-chart-3";
import { Chart, registerables } from "chart.js";
import gradient from "chartjs-plugin-gradient";

Chart.register(...registerables);

export default defineComponent({
	props: ["data"],
	name: "Chart",
	components: { LineChart },

  setup() {
    const lineRef = ref();

    onMounted(() => {
      console.log(lineRef.value);
    })
    return lineRef;
  },

The value of ref always returns undefined. Is there something I'm missing?

Version of vue-chart-3

3.1.8

Version of Vue

  • Vue 3
  • Vue 2
  • Nuxt 2
  • Nuxt 3
@rbartholomay
Copy link

same here

@blood1shot
Copy link

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants