Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

178
Visualizações
Vue: vue-echarts not rendered

I am creating a simple bar chart using vue-echart and Vue 2. I want to display a bar chart from Comp1.vue inside my home page, App.vue.

App.vue

<template>
  <div id="app">
    <Comp1/>
  </div>
</template>

<script>
import Comp1 from './components/Comp1.vue'

export default {
  name: 'App',
  components: {
    Comp1
  }
}
</script>

<style>
</style>

main.js

import Vue from 'vue'
import App from './App.vue'
import VueECharts from "vue-echarts";
import "@vue/composition-api";
import "echarts";

Vue.config.productionTip = false

Vue.component("v-chart", VueECharts);

new Vue({
  VueECharts,
  render: h => h(App),
}).$mount('#app')

Comp1.vue

<template>
<div style="height: 300px;">
    <v-chart :options="chartOptionsBar"></v-chart>
    Yes
</div>
</template>

<script>
export default {
  name: 'Comp1',
  data() {
      return {
        chartOptionsBar: {
        xAxis: {
            data: ['Latte', 'Espresso', 'Mocha', 'Cappucino']
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
            type: 'bar',
            data: [100, 50, 25, 10]
            }
        ]
        }
      }
  }
}
</script>

<style scoped>
</style>

I have imported all the possible dependencies but the chart is not rendered. I have no idea how this could happen. How should I solve this so that the chart gets rendered?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

<v-chart :options="chartOptionsBar"></v-chart>

I believe here should be option instead of options. According to the readme

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda