Advertisement
majweb

Untitled

Jun 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. //blade
  2. <select class="form-control" id="series" v-model="selected" name="series">
  3. <option>1</option>
  4. <option>2</option>
  5. <option>3</option>
  6. <option>4</option>
  7. <option>5</option>
  8. <option>6</option>
  9. <option>7</option>
  10. <option>8</option>
  11. <option>9</option>
  12. <option>10</option>
  13. </select>
  14.  
  15.  
  16. <div class="form-group @if ($errors->has('repeat')) has-error @endif">
  17. <div class="input-group">
  18. <span class="input-group-addon">
  19. <label for="repeat" class="label label-primary">
  20. Powtórzenia
  21. </label>
  22. </span>
  23. <input type="text" name="repeat" class="form-control" placeholder="Ilość powtórzeń" :value="repeats.repeat" >
  24. </div>
  25. @if ($errors->has('repeat')) <p class="help-block">{{ $errors->first('repeat') }}</p> @endif
  26. </div>
  27.  
  28. //laravel app.js
  29. const app = new Vue({
  30. el: '#app',
  31. data: {
  32. message: 'Hello Vue!',
  33. selected: '',
  34. options: [
  35. { text: '1', value: '1' },
  36. { text: '2', value: '2' },
  37. { text: '3', value: '3' },
  38. { text: '4', value: '4' },
  39. { text: '5', value: '5' },
  40. { text: '6', value: '6' },
  41. { text: '7', value: '7' },
  42. { text: '8', value: '8' },
  43. { text: '9', value: '9' },
  44. { text: '10', value: '10' }
  45. ],
  46. repeats: [],
  47. weights: [],
  48. times: []
  49. },
  50. methods:{
  51. onSubmit:function(){
  52. console.log('test');
  53. },
  54. addRow:function(){
  55. for(i = 0; i < this.selected; i++){
  56. this.repeats.push({repeat:''});
  57. this.weights.push({weight:''});
  58. this.times.push({time:''});
  59. }
  60. },
  61. deleteRow: function(index) {
  62. this.repeats.splice(index, 1);
  63. this.weights.splice(index, 1);
  64. this.times.splice(index, 1);
  65. }
  66. }
  67. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement