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?
Use the debounce method in lodash.
You can also write one yourself.