Advertisement
majweb

Untitled

Jun 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.47 KB | None | 0 0
  1. //lopp
  2. <div class="col-xs-12 col-md-4">
  3.     <ul class="list-unstyled">
  4.         <li v-for="(repeat, index) in repeats">
  5.             <span class="label label-violet">Powtórzenie @{{ index+1 }}</span>
  6.             <input type="text" v-model="repeat.repeat" :value="repeat.repeat">
  7.         </li>
  8.      </ul>
  9. </div>
  10.  
  11. //app.js
  12. const app = new Vue({
  13.     el: '#app',
  14.     data: {
  15.         message: 'Hello Vue!',
  16.         selected: '',
  17.         options: [
  18.             { text: '1', value: '1' },
  19.             { text: '2', value: '2' },
  20.             { text: '3', value: '3' },
  21.             { text: '4', value: '4' },
  22.             { text: '5', value: '5' },
  23.             { text: '6', value: '6' },
  24.             { text: '7', value: '7' },
  25.             { text: '8', value: '8' },
  26.             { text: '9', value: '9' },
  27.             { text: '10', value: '10' }
  28.         ],
  29.         repeats: [],
  30.         weights: [],
  31.         times: []
  32.     },
  33.     methods:{
  34.         onSubmit:function(){
  35.             console.log('sssssssssssssssssssssssssssssssss');
  36.         },
  37.         addRow:function(){
  38.             for(i = 0; i < this.selected; i++){
  39.                this.repeats.push({repeat:''});
  40.                this.weights.push({weight:''});
  41.                this.times.push({time:''});
  42.            }
  43.        },
  44.        deleteRow: function(index) {
  45.            this.repeats.splice(index, 1);
  46.            this.weights.splice(index, 1);
  47.            this.times.splice(index, 1);
  48.        }
  49.    }
  50. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement