Home > front end >  Vue query functionality
Vue query functionality

Time:09-19

Here is the vue I find on the Internet query function code!
Basic function is achieved, but the two query at the same time if there is a value is an empty result a search data is not to come out, excuse me each of the great god, and how to give them a value judgment is empty show! The ball, every help

Search () {
//support fuzzy queries
//this. XmgcqkJsonsData: used to search the total number of according to
//toLowerCase () : used to put the string converted to lowercase, make fuzzy query more clear
Let _search=this. QueryProject. ProjectName_1. ToLowerCase ();
Let a_num=this. QueryProject. ProjectNum. ToLowerCase ();
Let newListData=https://bbs.csdn.net/topics/[];//to hold search out new array of data
If (_search & amp; & A_num) {
Enclosing tableData_1. Filter (item=& gt; {
If (item. ProjectName_1. ToLowerCase (). The indexOf (_search)!==1 & amp; & Item. ProjectNum. ToLowerCase (). IndexOf (a_num)!==1) {
NewListData. Push (item);
}
})
}
Enclosing tableData_1=newListData;
//the console. The log (', 'new array newListData)
},

CodePudding user response:

1, you not call query, data filtering best
2, if you want to handle a null value in the query methods in the beginning, do a null value judgment for queries, if the query is null, the return directly

CodePudding user response:

Haven't written a vue only on baidu found such a way, now the vue got a headache
  • Related