Commit 51cf5b7c6760293f2a584a7f7dcb865de58a319f
Committed by
Gitee
1 parent
382c3a46
富文本编辑器自动聚焦问题 update yudao-ui-admin/src/components/Editor/index.vue.
修复富文本编辑器自动聚焦问题; 思路:初始化时初始化只读模式的编辑器,因为只读模式的编辑器不会因为聚焦问题带跑滚动条,然后根据传递的是否只读参数设置编辑器是否启用。 Signed-off-by: zbk <540064991@qq.com>
Showing
1 changed file
with
8 additions
and
1 deletions
yudao-ui-admin/src/components/Editor/index.vue
| ... | ... | @@ -84,7 +84,7 @@ export default { |
| 84 | 84 | ], |
| 85 | 85 | }, |
| 86 | 86 | placeholder: "请输入内容", |
| 87 | - readOnly: this.readOnly, | |
| 87 | + readOnly: true, | |
| 88 | 88 | }, |
| 89 | 89 | }; |
| 90 | 90 | }, |
| ... | ... | @@ -123,6 +123,13 @@ export default { |
| 123 | 123 | init() { |
| 124 | 124 | const editor = this.$refs.editor; |
| 125 | 125 | 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 | + }); | |
| 126 | 133 | // 如果设置了上传地址则自定义图片上传事件 |
| 127 | 134 | if (this.type === 'url') { |
| 128 | 135 | let toolbar = this.Quill.getModule("toolbar"); | ... | ... |