[Vuejs]-Why my wysiwyg editor works so slow in vuejs?

4๐Ÿ‘

โœ…

I think your best friend here is debounce. You can v-model a computed whose set function debounces the setting of the value:

debounceText: {
  get() { return this.text; },
  set: _.debounce(function(newValue) {
    this.text = newValue;
  }, 100)
},

You will see a little lag in the updating of the HTML output, but much less lag in the editor as you type. I have made a fiddle to demonstrate. Copy a bunch of text in and see how it handles for you.

Leave a comment