1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 13:14:20 +00:00

ajout d'un range slider pour filter les monstres par ID

This commit is contained in:
Maxime Moraine 2020-05-10 10:43:34 +02:00
parent 3efc2aaaf5
commit eebf902641
6 changed files with 58 additions and 3 deletions

View file

@ -106,6 +106,7 @@ export default {
computed: {
...mapState({
search: state => state.monsterFilters.search,
challengeRange: state => state.monsterFilters.challengeRange,
types: state => state.monsterFilters.types,
sizes: state => state.monsterFilters.sizes,
environments: state => state.monsterFilters.environments,
@ -115,6 +116,17 @@ export default {
monsters() {
let results = this.$pagination.pages
// Filter ID
let minID = this.challengeRange[0]
let maxID = this.challengeRange[1]
if (this.challengeRange[0] > this.challengeRange[1]) {
minID = this.challengeRange[1]
maxID = this.challengeRange[0]
}
results = results.filter(item => {
return item.frontmatter.challenge >= minID && item.frontmatter.challenge <= maxID
})
// Filter types
let selectedTypes = []
for (var i = 0; i < this.types.length; i++) {