According to the business needs of components, sometimes the keyword is returned to the background for search, and the data is then returned to the frontend for rendering after processing in the background (multiple requests to the server ); sometimes the front-end obtains all the page data, and the front-end processes the keyword search (affects page loading)
In this article, I will introduce the second situation. We need to first understand the filter () and pair des () of es6 ()
Filter () method to create a new array. The elements in the new array are checked by all the elements that meet the conditions in the specified array. Empty array is not detected. Does not change the original array.
Array. Filter (function (currentvalue, index, arr), thisvalue)
Click to learn http://www.runoob.com/jsref/jsref-filter.html
Instance: 80756563
The pair des () method is used to determine whether an array or string contains a specified value. If it is true, false is returned.
Click to learn http://www.runoob.com/jsref/jsref-filter.html
Hahaha it's easy to know the two functions.
1. search bar
2. Search for the corresponding list (do not use underscores to name the class)
3. Listen in Watch (this. alloptions is where you have obtained all the data from the background for storage)
Keyword Search for vue frontend processing listening