A
A
Analka2021-09-20 16:53:26
Vue.js
Analka, 2021-09-20 16:53:26

How to execute only once?

Has a text editor

<editor
      v-model="text"
      api-key="hkavs2b84i3jpj2k5ow7zmbj6lydkahcgg6cvp993ao0pl3h"
      :plugins="editorPlugins"
      :toolbar="editorToolbar"
      :init="editorInit"
      @input="returnValue"
    />


how to send redit event only once per minute,

function returnValue(data: any) {
      emit('input', data)
      setTimeout(() => {
        emit('redit', data)
      }, 60000)
    }


now how many characters I enter, so many times it calls redit

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2021-09-20
@0xD34F Vue.js

https://lodash.com/docs/4.17.15#throttle

A
Anton Anton, 2021-09-20
@Fragster

It is not clear what the editor component is, but https://ru.vuejs.org/v2/guide/forms.html#lazy may help to the original input, or bind to the change event, not input. You need to look at the API of the component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question