• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

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

23.02.28 00:33 작성 23.02.28 00:35 수정 조회수 1.13k

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>

답변 2

·

답변을 작성해보세요.

0

mijin님의 프로필

mijin

2024.02.01

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

0

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