我有来自https://tiptap.dev/installation/vue2#3-create-a-new-component的基本代码,但是当加载组件时,它抛出错误vue.esm.js?a026:628 [Vue warn]: Error in nextTick: "InvalidCharacterError: Failed to execute 'createElementNS' on 'Document': The qualified name provided ('[object HTMLDivElement]') contains the invalid name-start character '['."
执行命令:npm i @tiptap/vue-2 @tiptap/starter-kit
要素代码:
<template>
<editor-content :editor="editor" />
</template>
<script>
import { Editor, EditorContent } from '@tiptap/vue-3';
import StarterKit from '@tiptap/starter-kit';
export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
};
},
mounted() {
this.editor = new Editor({
content: `'<p>I’m running Tiptap with Vue.js. 🎉</p>'`,
extensions: [StarterKit],
});
},
beforeDestroy() {
this.editor.destroy();
},
};
</script>
1条答案
按热度按时间gorkyyrv1#
您导入了“@tiptap/vue-3”;虽然安装了npm i @tiptap/vue-2@tiptap/starter-kit两者不兼容,您需要安装正确的版本您使用,有你需要安装tiptap/vue 3