无法使用VUE-C3封装部件

问题描述 投票:2回答:1

我想在我的VUE JS的项目使用C3图表,所以我下载了这个包https://github.com/chryb/vue-c3首先,我有主成分生成处理财产,由于问题,例子表明,我们需要创建这个属性与新的Vue ()值:handler: new Vue()和Vue的返回错误:未定义的Vue。

其次我不明白为什么示例演示活动,如:qazxsw POI。不应该是像qazxsw POI,导致例如那些返回一个错误?

可能有人解释如何正确使用本VUE-C3包?

这里是我的代码:

主要成份:

this.handler.$emit('init', options)

图表组件:

this.$emit('init', options)
javascript charts vuejs2 package c3.js
1个回答
0
投票

来不及显然,要到OP有用的,但无论如何:

<template>
<div>
  <vue-chart @myEvent="init" :handler="handler"></vue-chart>    
</div>
</template>

<script>
import VueChart from '@/components/VueChart'

export default {
  name: 'HelloWorld',
  data () {
    return {
      handler: {}
    }
  },
  components: { VueChart }
}
</script>

该文件在你写<template> <div> Content </div> </template> <script> export default { name: 'VueChart', props: ['handler'], mounted () { const options = { data: { columns: [ ['data1', 2, 4, 5], ['data2', 1, 8, 9] ] } } this.$emit('init', options) } } </script>

© www.soinside.com 2019 - 2024. All rights reserved.