Optional prop generateOnInit, used in virt reg page

This commit is contained in:
2020-03-16 20:00:13 +01:00
parent 7a12c929aa
commit a702e0761a
2 changed files with 11 additions and 2 deletions

View File

@@ -119,7 +119,7 @@
</div>
</div>
<div v-else>
<RaffleGenerator @colors="setWithRandomColors" />
<RaffleGenerator @colors="setWithRandomColors" :generateOnInit="true" />
</div>
</div>
<br />

View File

@@ -60,6 +60,13 @@
<script>
export default {
props: {
generateOnInit: {
type: Boolean,
required: false,
default: false
}
},
data() {
return {
numberOfBallots: 4,
@@ -79,12 +86,14 @@ export default {
},
beforeMount() {
this.$emit("numberOfBallots", this.numberOfBallots);
if (this.generateOnInit) {
this.generateColors();
}
},
watch: {
numberOfBallots: function() {
this.$emit("numberOfBallots", this.numberOfBallots);
this.generateColors();
this.emitColors();
}
},
methods: {