简体   繁体   English

无法挂载组件:使用 vue-c3

[英]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.

相关问题 无法使用vue-c3软件包组件 - Unable to use vue-c3 package component VUE 挂载组件笔记失败 - VUE Failed to mount component notes [Vue 警告]:使用带有参数的 mixin 时无法挂载组件 - [Vue warn]: Failed to mount component when using mixin with a parameter 尽管使用了完整的编译器捆绑包,但Vue中的“无法安装组件:模板或渲染功能未定义” - “Failed to mount component: template or render function not defined” in Vue, despite using full compiler bundle 无法挂载组件:模板或渲染函数未使用 vue.js 定义 - Failed to mount component: template or render function not defined using vue.js Laravel - [Vue 警告]:无法挂载组件:未定义模板或渲染函数 - Laravel - [Vue warn]: Failed to mount component: template or render function not defined Laravel 5.3.10 + Vue.js 2.0.1上的“无法安装组件”错误 - "Failed to mount component” error on Laravel 5.3.10 + Vue.js 2.0.1 无法安装组件:模板或渲染函数未定义-使用Laravel-mix时出现vue警告 - Failed to mount component: template or render function not defined - vue warning when using Laravel-mix Vue警告:无法安装组件:未定义模板或渲染功能 - Vue warn: Failed to mount component: template or render function not defined Vue.js 2- 无法安装组件:模板或渲染 function 未定义 - Vue js 2- Failed to mount component: template or render function not defined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM