add range functionality

This commit is contained in:
vincent 2019-05-09 13:17:03 +02:00
parent 0cc42a3ee4
commit d08edaa007

View File

@ -92,10 +92,17 @@ export default {
}
this.$store.state.arrayresultchaines = [];
const arraychaine = [...new Set(this.chaine.split(" "))];
const re = new RegExp("^[0-9]*-[0-9]*$");
arraychaine.forEach(element => {
if (element != "") {
this.$store.dispatch('getchaine',{num:element});
if(re.test(element)){
var range=element.split("-")
for (var i = range[0]; i <= range[1]; i++) {
this.$store.dispatch('getchaine',{num:i});
}
}else{
this.$store.dispatch('getchaine',{num:element});
}
}
});
},