我看到了添加羽毛笔污点的文档,但是作为一个通过使用vue学习js的新程序员,我不知道该放在哪里。我想更改类名以使用顺风CSS类。
我通过npm安装了“ vue-quill-editor”,并使用下面的代码进行编辑。
<template>
<section class="container">
<no-ssr>
<div
v-quill:myQuillEditor="editorOption"
class="quill-editor"
:content="content"
@change="onEditorChange($event)"
></div>
</no-ssr>
</section>
</template>
<script>
/*
Emits the html content to parent using editor-content
a parent example <quill @editor-content="form.content = $event" />
*/
export default {
data() {
return {
content: "<p>Start typing post...</p>",
editorOption: {
// some quill options
modules: {
toolbar: [
["bold", "italic", "underline", "strike"],
["blockquote", "code-block"],
[{ list: "ordered" }, { list: "bullet" }],
[{ indent: "-1" }, { indent: "+1" }], // outdent/indent
[{ size: ["small", false, "large", "huge"] }], // custom dropdown
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ color: [] }, { background: [] }], // dropdown with defaults from theme
[{ font: [] }],
[{ align: [] }],
["clean"]
]
}
}
};
},
methods: {
onEditorChange({ editor, html, text }) {
this.content = html;
this.$emit("editor-content", this.content);
}
}
};
</script>
<style scoped>
.quill-editor {
min-height: 200px;
max-height: 400px;
overflow-y: auto;
}
</style>
答案 0 :(得分:0)
您应该将其放在已安装的钩子中,因为纤管在DOM上起作用。