ReferenceError: rootgetters is not defined

행행·2022년 7월 27일
0

전역변수를 사용해야 하는 경우, rootgetters, rootstate를 사용하여
다른 모듈에 있는 내용을 사용할 수 있다.
그러나 이는 3번까지 밖에 안된다.
따라서 3번만 rootgetter, rootstate를 사용하고 다른 방식으로 접근해야한다.


  • 공식홈페이지 내용

Accessing Global Assets in Namespaced Modules#
If you want to use global state and getters, rootState and rootGetters are passed as the 3rd and 4th arguments to getter functions, and also exposed as properties on the context object passed to action functions.

To dispatch actions or commit mutations in the global namespace, pass { root: true } as the 3rd argument to dispatch and commit.

profile
성장하려고 분투 중인 개발자

0개의 댓글