Skip to content

Commit f220582

Browse files
committed
Random Guilds
1 parent 90e1849 commit f220582

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

src/components/HomeGuilds/Index.vue

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
row
2323
wrap>
2424
<v-flex
25-
v-for="(guild, index) in guilds"
25+
v-for="(guild, index) in getGuilds"
2626
:key="index"
2727
sm12
2828
md4>
@@ -49,30 +49,24 @@ import { mapGetters } from 'vuex'
4949
},
5050
data () {
5151
return {
52-
guilds: []
52+
5353
}
5454
},
5555
computed: {
5656
...mapGetters( [ 'allGuilds' ] ),
5757
58-
},
59-
created() {
60-
this.guilds.splice(0, this.guilds.length)
61-
console.log("*******************")
62-
console.log(this.guilds)
63-
for(let x=0; x<= 2;x++){
64-
65-
let i = Math.random() * (0 - this.allGuilds.length)
66-
i = Math.round(i)
67-
i = Math.abs(i)
68-
this.guilds.push(this.allGuilds[x])
69-
console.log(i)
70-
//this.guilds.push(this.allGuilds[i])
71-
}
72-
console.log(this.guilds)
73-
58+
getGuilds(){
59+
let guilds= []
7460
61+
for(let x=0; x<= 2;x++){
62+
let i = Math.random() * (0 - (this.allGuilds.length -1))
63+
i = Math.round(i)
64+
i = Math.abs(i)
65+
guilds.push(this.allGuilds[i])
66+
}
67+
return guilds
7568
}
69+
},
7670
}
7771
7872
</script>

0 commit comments

Comments
 (0)