Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.onload = () => {
- let app = new Vue({
- //Переменные
- el: '#app',
- data: {
- days: '',
- money: '',
- height: '',
- sex: '',
- req_data: [],
- resp: ''
- },
- //Точка отправки в бэк
- mounted() {
- axios.get('http:localhost:8000/api/calculator')
- .then(resp => {this.req_data = resp.data})
- .catch(error => {console.log(error.message)})
- },
- methods: {
- //Отправка данных
- request_answer: function () {
- if (this.days !== '' && this.money !== '' && this.height !== '' && this.sex !== ''){
- this.req_data.push({
- days: this.days,
- money: this.money,
- height: this.height,
- sex: this.sex
- });
- this.days = '',
- this.money = '',
- this.height = '',
- this.sex = ''
- }
- }
- }
- })
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement