[英]Failed to mount component: using vue-c3
I tried using https://www.npmjs.com/package/vue-c3 for rendering my c3 charts in vue.我尝试使用https://www.npmjs.com/package/vue-c3在 vue 中呈现我的 c3 图表。 It worked some time ago, but now it started giving (in VueC3):
它在前一段时间有效,但现在它开始提供(在 VueC3 中):
"vue.runtime.esm.js?ff9b:587 [Vue warn]: Failed to mount component: template or render function not defined." “vue.runtime.esm.js?ff9b:587 [Vue 警告]:无法挂载组件:未定义模板或渲染函数。”
even when using a code from a tutorial:即使使用教程中的代码:
<template>
<div>
<vue-c3 :handler="handler"></vue-c3>
</div>
</template>
<script>
import Vue from 'vue'
import VueC3 from 'vue-c3'
export default {
name: ...,
components: {
VueC3
},
data () {
return {
handler: new Vue()
}
}
}
</script>
How can I fix this?我怎样才能解决这个问题?
I faced the same exact problem.我遇到了同样的问题。 In my case it seems the bug was introduced after upgrading vue-c3 package to its latest version (v1.2.5 at the time of writing).
就我而言,似乎是在将 vue-c3 包升级到其最新版本(撰写本文时为 v1.2.5)之后引入了该错误。
What I did was to temporarily stick to our previous version (v1.1.1) in package.json (until it is fixed):我所做的是在 package.json 中暂时坚持我们以前的版本(v1.1.1)(直到它被修复):
{ "vue-c3": "1.1.1" }
and worked again.并再次工作。
If you import Vue from 'vue';如果你从 'vue' 导入 Vue; you get the runtime only build that cannot compile templates so you need the standalone build, here is a small tutorial that explain this: https://v2.vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
您将获得无法编译模板的仅运行时构建,因此您需要独立构建,这是一个解释这一点的小教程: https ://v2.vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs- 仅运行时
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.