我有一个 Vue SPA,正在尝试迁移到 Nuxt,这是我的第一次尝试。我已经复制了我的组件,并且已经将依赖项添加回我的 package.json,但是在进入 vue-quill-editor 后,我开始发现文档未定义。
错误页框:
ReferenceError
document is not defined
node_modules/quill/dist/quill.js:7661:12
node_modules/quill/dist/quill.js:36:30
__webpack_require__
node_modules/quill/dist/quill.js:1030:1
node_modules/quill/dist/quill.js:36:30
__webpack_require__
node_modules/quill/dist/quill.js:5655:14
node_modules/quill/dist/quill.js:36:30
__webpack_require__
node_modules/quill/dist/quill.js:10045:13
node_modules/quill/dist/quill.js:36:30
__webpack_require__
Run Code Online (Sandbox Code Playgroud)
我尝试将使用鹅毛笔编辑器的两个组件包装在
ReferenceError
document is not defined
node_modules/quill/dist/quill.js:7661:12
node_modules/quill/dist/quill.js:36:30
__webpack_require__
node_modules/quill/dist/quill.js:1030:1
node_modules/quill/dist/quill.js:36:30
__webpack_require__
node_modules/quill/dist/quill.js:5655:14
node_modules/quill/dist/quill.js:36:30
__webpack_require__
node_modules/quill/dist/quill.js:10045:13
node_modules/quill/dist/quill.js:36:30
__webpack_require__
Run Code Online (Sandbox Code Playgroud)
标签,但这根本没有改变任何东西。这是其中一个组件:
<client-only>
Run Code Online (Sandbox Code Playgroud)
<template>
<client-only>
<div>
<b-card no-body class="mt-4">
<b-card-header>
Notes
</b-card-header>
<b-card-body>
<quill-editor v-model="contents" :content="contents"></quill-editor>
</b-card-body>
</b-card>
</div>
</client-only>
</template>
<script>
Run Code Online (Sandbox Code Playgroud)
我查看了许多 SO 线程,但没有一个起作用。如果需要更多信息,请说:)
我很感激任何帮助
我想显示一些html从数据库中获取的内容quill editor。似乎html很好(在<p>段落中显示)并且绑定到quill editorvia v-model,但它只是不显示:
<template>
<div id="text-editor" class="text-editor">
<quill-editor :modules="modules" :toolbar="toolbar" v-model:content="store.re.body" contentType="html"/>
<p>{{store.re.body}}</p>
</div>
</template>
<script setup>
import BlotFormatter from 'quill-blot-formatter'
import store from "../../../js/store";
store.re.body = ''
const modules = {
module: BlotFormatter,
}
const toolbar = [
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'size': ['small', false, 'large', 'huge'] }],
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],
[{ 'align': [] }],
[{ 'list': …Run Code Online (Sandbox Code Playgroud)