Reputation: 79
Here is my fiddle. https://jsfiddle.net/7nxhygLp/20/
methods:{
addRow: function(){
for(var i=0; i < this.number; i++){
this.rows.push({});
}
},
How do I make it so the length of rows does not exceed 10?
Upvotes: 0
Views: 40
Reputation: 79
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({});
}
}
}
Upvotes: 0
Reputation: 1324
methods:{
addRow: function(){
for(var i=0; i < this.number && i < 10; i++){
this.rows.push({});
}
},
Upvotes: 2