vue-quill-editor富文本渲染完成自動獲取焦點,問題在於數據請求完成,富文本內容發生變化從而自動獲取焦點html
mounted() { this.$refs.myQuillEditor.quill.enable(false); this.hintGetFun(); }, methods: { onEditorChange({ quill, html, text }) { this.formHint.hintList[this.hintIndex].hintValue = html; }, async hintGetFun() { try { let res = await hintGet(this.$route.params.pk); if (res.data.code == "S00000") { this.formHint.hintList = res.data.data; //富文本編輯器神坑處理 this.$nextTick(function() { this.$refs.myQuillEditor.quill.enable(true); this.$refs.myQuillEditor.quill.blur(); }); } } catch (err) { console.log(err); } }
數據請求完成執行$nextTick這樣就能夠完美解決富文本自動獲取焦點問題。vue