A
A
Alexander Ivanov2018-02-05 14:27:47
Vue.js
Alexander Ivanov, 2018-02-05 14:27:47

How to get specific properties in JSON vue?

connected json

var apiWorkers = $.getJSON('http://laravel/workers.api',function(apiWorkers){
    console.log(apiWorkers);
});

export default {
    data(){
        return{
            btn_txt: "Искать",
            arr: apiWorkers,
            arrTO: typeof apiWorkers
        }
    }
}

take out
<ul>
            <li v-for="(item, index) in arr">{{ index }} - {{ item }} </li>
        </ul>

I receive

readyState -
getResponseHeader -
...
responseJSON -
...

But I only need what is responseJSON.
How to access the desired parameter in json in this case?
// так пустышка на выходе
// Vue.axios.get(apiWorkers).then(function(response){
//     console.log(response.data);
// });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2018-02-05
@cimonlebedev

this right way
https://alligator.io/vuejs/rest-api-axios/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question