vue table data query

computed: { 
      // fuzzy search 
      the Tables () { 
        const Search this.search = 
        IF (Search) { 
          create a new array // filter () method, the new element in the array by checking the specified array qualifying all the elements . 
          // Note: filter () will not be an empty array detection. 
          // Note: filter () does not alter the original array. 
          this.dormitory.filter return (Data => { 
            // some () method for detecting elements in the array satisfies the specified conditions; 
            // some () method in turn executes each element of the array: 
            if an element // conditions are satisfied, the expression returns true, the remaining elements will not perform detection; 
            // element if the condition is not satisfied, false is returned. 
            // Note: some () does not detect an empty array. 
            // NOTE: some () does not alter the original array. 
            return Object.keys (Data) .some (Key => {
              // indexOf () returns the position of a specified character first appeared in a string, it returns -1 if not found;
              // This method is case-sensitive! So before the need toLowerCase () method to query the contents of all lowercase. 
              String return (Data [Key]). the toLowerCase (). the indexOf (Search)> -1 
            }) 
          }) 
        } 
        return this.dormitory 
      } 
    },
---------------- 
Copyright : this article is CSDN bloggers 'struggle it small rookie' original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement. 
Original link: https: //blog.csdn.net/luzhaopan/article/details/81569907

  

Guess you like

Origin www.cnblogs.com/baixinL/p/12204662.html