[Vuejs]-How do I make it so the length of rows does not exceed 10?

2👍

methods:{

  addRow: function(){

    for(var i=0; i < this.number && i < 10; i++){

      this.rows.push({});

    }

},
👤Ogie

0👍

Anyone looking for the answer.
you can review this fiddle.

https://jsfiddle.net/7nxhygLp/21/

 methods:{
  addRow: function(){
    this.number = parseInt(this.number);
            if(total + this.number <= 10)
    {
                        total += this.number;
                        for(var i=0; i < this.number; i++){
                      this.rows.push({});
                    }
      }
  }

Leave a comment