javascript - How do you usually solve the problem of delayed requests after Vue.js2.0 cannot use debounce.
过去多啦不再A梦
过去多啦不再A梦 2017-06-28 09:28:57
0
1
806

There are often requirements similar to this, such as requesting the corresponding pinyin when the user enters a name. In order to reduce useless requests, the request is initiated after 300ms after the input value has not changed. I currently implement it by directly storing setTimeout in a variable, but my friend said that there are some problems with this, and it is better to use debounce. After searching, I found that vue.js2.0 no longer supports debounce. I would like to ask the experts how to achieve this requirement?

过去多啦不再A梦
过去多啦不再A梦

reply all(1)
世界只因有你

Use the debounce method in lodash.

You can also write one yourself.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template