我有来自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>发布于 2022-12-04 14:35:26
您导入了'@tiptap/vue-3';虽然已安装了npm i @tiptap/vue-2 @tiptap/starter kit都是不兼容的,但是您需要安装正确的使用版本,需要安装tiptap/vue 3。
https://stackoverflow.com/questions/72858511
复制相似问题