dumptyd / vue-css-donut-chart

Lightweight Vue component for drawing pure CSS donut charts
https://dumptyd.github.io/vue-css-donut-chart/
MIT License
128 stars 19 forks source link

How to use with nuxt? #31

Closed ddiegommachado closed 4 years ago

ddiegommachado commented 4 years ago

I try use with nuxt, but don't worked!

I'm importing inside of the component

index.vue

<template>
<vc-donut :sections="sections">Basic donut</vc-donut> 
< /template>

<script>
import Donut from "vue-css-donut-chart";
import "vue-css-donut-chart/dist/vcdonut.css";
Vue.use(Donut);

data() {
      return {
        sections: [{ value: 25 }, { value: 25 }]
      };
    }
</script>
mavatika commented 4 years ago

If you plan to to use it in many components, just create a file inside plugin where you import Vue, Donut and the css and then you run Vue.use(Donut). Then in nuxt.config add that file to the plugins array and maybe it'd be necessary to set its mode to client. If you want to just import it in your component, try by removing Vue.use from your component and add the components property to the export default object and register the component.

ddiegommachado commented 4 years ago

Thank you!!!! I solved