강의

멘토링

커뮤니티

Inflearn Community Q&A

josun10272's profile image
josun10272

asked

Vue.js Intermediate Course - Learn Vue.js, ES6, and Vuex by creating a web app

[Refactoring & Quiz] Applying mutations and Quiz Information

왜 발생하는 걸까요??Property or method "store" is not defined on the instance but referenced during render.

Written on

·

1.5K

·

Edited

1

Todo-Header.vue 파일에 코딩된 내용은 아래와 같습니다.

<template>
  <header>
<!--    <h1>TODO it!</h1>-->
        <h1>{{ this.$store.state.headerText }}</h1>
  </header>
</template>

위 코드를 실행했을때 store 못 찾는 다고 나오는데 이유를 모르겠네요 ㅠ.ㅠ

[Vue warn]: Property or method "store" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

---> <TodoHeader> at src/components/TodoHeader.vue

<App> at src/App.vue

<Root>

vuexvue.jses6javascriptvuejs

Answer 2

0

저는 아래 방법으로 해결됐습니다.
export const store = new Vuex.Store({});
⇓ "export default" 로 수정
export default new Vuex.Store({});

0

captain님의 프로필 이미지
captain
Instructor

안녕하세요, 뷰 인스턴스에 뷰엑스가 잘 연결 되어 있는지 확인해 보시겠어요?

josun10272's profile image
josun10272

asked

Ask a question