<> I made an interesting request recently , The front end implements simple product search and sorting
class SearchList { constructor() { this.showList = [] // Displayed list data this.list = []
// All list data } // Perform search search(key, arr) { let arrTrueList = [], // Matching data
arrFalseList= []; // Mismatch data arr.forEach(item => { // Judge input value key Does it exist on the object array if (this
.loopObj(key, item)) { item.showStatus = true arrTrueList.push(item) } else {
item.showStatus = false arrFalseList.push(item) } }) this.showList = arrTrueList
this.list = arrTrueList.concat(arrFalseList) return this } // Use recursive traversal of all properties to determine whether
Match the value in the object draw lessons from js How to copy objects deeply loopObj(searkey, obj) { let bool = false let loop = (
searkey, obj) => { for (let key in obj) { if (String(obj[key]).trim().indexOf(
searkey) !== -1) { bool = true } if (typeof obj[key] === 'object' && obj[key]
!== null) { loop(searkey, obj[key]) } } } loop(searkey, obj) return bool; } //
obtain Displayed list getShowList() { return this.showList } // obtain Full list getList() { return
this.list } } export default new SearchList()

Technology
©2019-2020 Toolsou All rights reserved,
( Super detail )Eclipse Using tutorials —— use Eclipse Create first HelloWorld! Database operation 5 code implementation mysql Addition, deletion, modification and query of database What can MCU do , Do you have any interesting works made by MCU or open source hardware Go to the interview after reading this , Steady over ~~ Single linked list of primary data structure (C Language implementation )SQL Comprehensive questions Employee unit comprehensive questions Python Implementation of Hanoi Tower code VHDL——JK trigger It's over , Starting salary 30k