Optimisation, si pas de caractere, on ne passe pas dans le filtre
This commit is contained in:
parent
ef82382f33
commit
99a6444c39
2 changed files with 11 additions and 12 deletions
|
@ -109,14 +109,13 @@ let monTableau = {
|
|||
},
|
||||
computed: {
|
||||
tableau: function () {
|
||||
if (!this.search) {
|
||||
return this.pagination(this.table);
|
||||
}
|
||||
return this.pagination(
|
||||
this.table.filter((ligne) => {
|
||||
if (this.search) {
|
||||
return Object.values(ligne).toString().toLowerCase().indexOf(this.search) < 0 ? false : true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
this.table.filter((ligne) =>
|
||||
Object.values(ligne).toString().toLowerCase().indexOf(this.search.toLowerCase()) < 0 ? false : true
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -130,12 +130,12 @@ var monTableau = {
|
|||
tableau: function tableau() {
|
||||
var _this = this;
|
||||
|
||||
if (!this.search) {
|
||||
return this.pagination(this.table);
|
||||
}
|
||||
|
||||
return this.pagination(this.table.filter(function (ligne) {
|
||||
if (_this.search) {
|
||||
return Object.values(ligne).toString().toLowerCase().indexOf(_this.search) < 0 ? false : true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return Object.values(ligne).toString().toLowerCase().indexOf(_this.search.toLowerCase()) < 0 ? false : true;
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue