Optional prop generateOnInit, used in virt reg page
This commit is contained in:
		@@ -119,7 +119,7 @@
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div v-else>
 | 
			
		||||
        <RaffleGenerator @colors="setWithRandomColors" />
 | 
			
		||||
        <RaffleGenerator @colors="setWithRandomColors" :generateOnInit="true" />
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <br />
 | 
			
		||||
 
 | 
			
		||||
@@ -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: {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user