victorgarciaesgi / vue-chart-3

📊 A simple wrapper around Chart.js 3 for Vue 2 & 3

Home Page:https://vue-chart-3.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get this to work, missing template

ellogwen opened this issue · comments

I am getting this error message:

Failed to mount component: template or render function not defined.

found in

---> <BarChart>

This is my simple component:

<template>
    <BarChart
        :chartData="datacollection"
    />
</template>

<script>
import { Chart, registerables } from 'chart.js';
import BarChart from 'vue-chart-3'

Chart.register(...registerables);

export default {
    components: { BarChart },
    data() {
        return {
            datacollection: {
                labels: ['1.', '2.', '3.'],
                datasets: [
                    {
                        label: 'consumption',
                        data: [
                            10, 20, 10, 44
                        ]
                    }
                ]
            },
        }
    },
}
</script>

I added chartjs, vue-chart-3 and @vue/composition-api to the project. I am not using the composition api for my own components. Is this the issue? can't I mix composition and traditional components?

Nevermind, I am dumb. I forgot the curly braces for the import

import { BarChart } from 'vue-chart-3'

I am sorry.

Aha no problem @ellogwen !