Basic sorting
This commit is contained in:
parent
5a9ae69368
commit
16ca3af64b
1 changed files with 4 additions and 4 deletions
|
@ -77,13 +77,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
dynamicSortBy () {
|
||||||
|
return this.search.length >= 3 ? 'sortScore' : this.sortBy
|
||||||
|
},
|
||||||
pageMax () {
|
pageMax () {
|
||||||
let trueMax = this.filteredSpells.length / this.perPage
|
let trueMax = this.filteredSpells.length / this.perPage
|
||||||
return trueMax < 1 ? 1 : trueMax
|
return trueMax < 1 ? 1 : trueMax
|
||||||
},
|
},
|
||||||
dynamicSortBy () {
|
|
||||||
return this.search.length >= 3 ? 'sortScore' : 'name'
|
|
||||||
},
|
|
||||||
pagedSpells () {
|
pagedSpells () {
|
||||||
return new Query(this.filteredSpells)
|
return new Query(this.filteredSpells)
|
||||||
.paginate(this.page, this.perPage)
|
.paginate(this.page, this.perPage)
|
||||||
|
@ -92,7 +92,7 @@ export default {
|
||||||
filteredSpells () {
|
filteredSpells () {
|
||||||
return new Query(this.spells)
|
return new Query(this.spells)
|
||||||
.search('name', this.search, 5)
|
.search('name', this.search, 5)
|
||||||
.sort(this.dynamicSortBy)
|
.sort(this.sortBy)
|
||||||
.results
|
.results
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue