【发布时间】:2020-03-10 03:44:37
【问题描述】:
我使用渲染方法创建了以下功能组件:
import Vue from "vue"
const { render, staticRenderFns } = Vue.compile(`<div>Hello World</div>`)
Vue.component("HelloWorld", {
functional: true,
render,
staticRenderFns
})
然后在App.vue:
<template>
<div id="app">
<HelloWorld />
</div>
</template>
<script>
export default {
data() {
return {
compiled: false
}
}
}
</script>
<style>
</style>
我得到了错误:
_c is not defined.
我在这里做错了吗?
【问题讨论】:
-
看这个 - stackoverflow.com/questions/44369839/… 你需要导入你的组件
-
导入我的组件?但它已经被声明为一个全局组件。而且,此问题仅与功能组件有关。普通组件工作正常,即如果我删除
functional: true它工作正常。 -
@webnoob 该死的,这很有用。非常感谢。虽然不确定功能组件。
标签: javascript vue.js vuejs2 vue-component