강의

멘토링

커뮤니티

Inflearn Community Q&A

siudevelop2517's profile image
siudevelop2517

asked

Want to learn Vue.js properly? (A week before starting a Vue.js project)

Mixins

페이지를 진입 할때 데이터를 불러 오고 싶습니다.

Written on

·

198

0

import ApiMixin from '../api.js';
    export default {
        mixins:[ApiMixin],
        data(){
            return {
                studyLists:[]
            };
        },
        mounted(){
            getStudyList();
        },
        methods:{
            async getStudyList(){
                this.studyLists = await this.$callAPI(
                    "/api/study",
                    "get",
                    {}
                );
                console.log(this.studyLists);
            },
        },
    }

위와 같이 코드를 작성했는데

getStudyList is not define이라고

나오면서 오류가 발생하고 있습니다.

라이프사이클을 보면 생성 직전에 메소드를 작동하도록 

해놓을 생각이였는데 보통 mounted를 먼서 실행하고 

메소드를 불러 오나요?

또한 위에 사항에 대한 해결책은 어떤것들이 있을까요?

vueapivuejsvuex

Answer

This question is waiting for answers
Be the first to answer!
siudevelop2517's profile image
siudevelop2517

asked

Ask a question