做的博客系统编辑文章功能
editor无法获取传过来的文章内容
<div class="ql-conrainer ql-snow">
<quill-editor
class="editor"
v-model="content"
ref="myQuillEditor"
:options="editorOption"
@blur="onEditorBlur($event)"
@focus="onEditorFocus($event)"
></quill-editor>
</div>
属性
props: {
/*编辑器的内容*/
value: {
type: String
}
},
components: {
quillEditor
},
data() {
return {
content: this.value,
editorOption: {
placeholder: "",
theme: "snow", // or 'bubble'
placeholder: "请输入...",
modules: {
toolbar: {
container: toolbarOptions,
// container: "#toolbar",
}
}
},
};
},
methods: {
onEditorBlur() {
//失去焦点事件
},
onEditorFocus() {
//获得焦点事件
},
onEditorChange() {
//内容改变事件
this.$emit("input", this.content);
}
},
computed: {
editor() {
return this.$refs.myQuillEditor.quill;
},
}