【发布时间】:2018-09-23 00:43:51
【问题描述】:
所以我想在我的页面的 vue 组件中使用 vue-html-editor,但它不起作用。我是 vue 和 vue 组件的新手,所以我认为这应该是一件容易的事,但不知何故,我正磕磕绊绊。
我的组件:
<template>
<div class="container">
<vue-html-editor name="html-editor" :model.sync="text"></vue-html-editor>
<div style="margin-top:40px">
<div> The HTML contents are as follows:</div>
<hr>
<div>{{ text }}</div>
</div>
</div>
</template>
<script>
export default {
name: 'Edit',
components: {
"vue-html-editor": require("vue-html-editor")
},
data() {
return {
text: 'Start writing your notes here...'
}
}
}
</script>
<style scoped>
</style>
还有控制台报错信息:
vue.esm.js?efeb:591 [Vue warn]: Failed to mount component: template or render function not defined.
found in
---> <VueHtmlEditor>
<Edit> at src/components/Edit.vue
<App> at src/App.vue
<Root>
我已经安装了 vue-html-editor 但我认为我没有正确加载编辑器。
感谢任何帮助。提前致谢!
【问题讨论】:
-
好吧,我想到的就是:你
npm install vue-html-editor吗? -
是的,我确实安装了 vue-html-editor,就像页面中的设置步骤中提到的那样。
标签: vue.js vue-component