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