vue-quill-editor富文本焦點問題


vue-quill-editor富文本渲染完成自動獲取焦點,問題在於數據請求完成,富文本內容發生變化從而自動獲取焦點

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這樣就可以完美解決富文本自動獲取焦點問題。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM