Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. window.onload = () => {
  2. let app = new Vue({
  3. //Переменные
  4. el: '#app',
  5. data: {
  6. days: '',
  7. money: '',
  8. height: '',
  9. sex: '',
  10. req_data: [],
  11. resp: ''
  12. },
  13. //Точка отправки в бэк
  14. mounted() {
  15. axios.get('http:localhost:8000/api/calculator')
  16. .then(resp => {this.req_data = resp.data})
  17. .catch(error => {console.log(error.message)})
  18. },
  19. methods: {
  20. //Отправка данных
  21. request_answer: function () {
  22. if (this.days !== '' && this.money !== '' && this.height !== '' && this.sex !== ''){
  23. this.req_data.push({
  24. days: this.days,
  25. money: this.money,
  26. height: this.height,
  27. sex: this.sex
  28. });
  29.  
  30. this.days = '',
  31. this.money = '',
  32. this.height = '',
  33. this.sex = ''
  34.  
  35.  
  36.  
  37. }
  38. }
  39.  
  40. }
  41. })
  42. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement