Javascript Vue JS调用API的问题

Javascript Vue JS调用API的问题,javascript,arrays,api,vue.js,vuejs2,Javascript,Arrays,Api,Vue.js,Vuejs2,我目前正在学习Vue.js,在调用API时遇到了问题。我从访问这个公共API,在访问电影细节时遇到问题。我有电影的数据,但数据是在最后一个数组中堆积起来的,我不知道该怎么办。希望你们能帮助我:D <script> import axios from 'axios'; export default { name: 'home', data: () => ({ profiles: [], last_name_v: '',

我目前正在学习Vue.js,在调用API时遇到了问题。我从访问这个公共API,在访问电影细节时遇到问题。我有电影的数据,但数据是在最后一个数组中堆积起来的,我不知道该怎么办。希望你们能帮助我:D

<script>
import axios from 'axios';

export default {
    name: 'home',
    data: () => ({
        profiles: [],
        last_name_v: '',
        movies_urls: [],
        movies: [],
        movie_s: [],
        relateds: [],
        errors: [],
        datas: []
    }),

    created() {
        axios.get('https://swapi.co/api/people/')
            .then(response => {
                this.profiles = response.data.results.slice(0, 2);
                for (var i = 0; i < this.profiles.length; i++) {
                    var profile_val = this.profiles[i];
                    var full_name_o = profile_val.name;
                    var full_name_s = full_name_o.split(' ');
                    var last_name = full_name_s[full_name_s.length - 1];
                    profile_val['last_name'] = last_name;

                    var movie_urls = profile_val.films.slice(0, 4);
                    console.log(profile_val.films.slice(0, 4));
                    profile_val['movie_details'] = [];
                    for (var j = 0; j < movie_urls.length; j++) {
                        axios.get(movie_urls[j])
                            .then(response => {
                                profile_val.movie_details.push(response.data);
                            })
                            .catch(e => {
                                this.errors.push(e);
                            });
                    }
                    this.datas.push(profile_val);
                }
            })
            .catch(e => {
                this.errors.push(e);
            });
    }
}

您认为一旦您的内部for循环中的所有承诺都得到解决,profile_val的价值将是什么

for (var j = 0; j < movie_urls.length; j++) {
    axios.get(movie_urls[j])
        .then(response => {
            profile_val.movie_details.push(response.data);
        })
        .catch(e => {
            this.errors.push(e);
        });
}

同时发布输出以澄清:您所说的数据堆积在最后一个数组中是什么意思?数据是什么?最后一个数组是什么?
function fetchMovieDetails (profile_val, movie_url) {
    return axios.get(movie_url)
        .then(res => profile_val.movie_details.push(res.data));
}