Skip to content

Commit 6143f59

Browse files
zhangbokanggitee-org
authored andcommitted
富文本编辑器自动聚焦问题 update yudao-ui-admin/src/components/Editor/index.vue.
修复富文本编辑器自动聚焦问题; 思路:初始化时初始化只读模式的编辑器,因为只读模式的编辑器不会因为聚焦问题带跑滚动条,然后根据传递的是否只读参数设置编辑器是否启用。 Signed-off-by: zbk <[email protected]>
1 parent 41867d5 commit 6143f59

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/Editor/index.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default {
8484
],
8585
},
8686
placeholder: "请输入内容",
87-
readOnly: this.readOnly,
87+
readOnly: true,
8888
},
8989
};
9090
},
@@ -123,6 +123,13 @@ export default {
123123
init() {
124124
const editor = this.$refs.editor;
125125
this.Quill = new Quill(editor, this.options);
126+
// 取消自动聚焦 start
127+
this.$nextTick(()=>{
128+
this.Quill.blur();
129+
if(!this.readOnly){
130+
this.Quill.enable();
131+
}
132+
});
126133
// 如果设置了上传地址则自定义图片上传事件
127134
if (this.type === 'url') {
128135
let toolbar = this.Quill.getModule("toolbar");

0 commit comments

Comments
 (0)