itsource

등록된 모든 Vuex 모듈을 가져오는 방법

mycopycode 2022. 8. 31. 22:49
반응형

등록된 모든 Vuex 모듈을 가져오는 방법

모든 Vuex 모듈에서 반복할 수 있는 방법이 있습니까?모듈 이름을 이렇게 등록했습니다.

$store.registerModule('module-xyz', module);

이제 그들 모두의 명단을 얻을 수 있는 방법은 없을까?

문서화되어 있지 않지만 모든 모듈은_modules속성:

console.log(this.$store._modules.root._children);

또한 다음과 같이 모듈의 존재 여부를 확인할 수 있습니다.

console.log(this.$store.hasModule('module-xyz'));

언급URL : https://stackoverflow.com/questions/66139527/how-to-get-all-registered-vuex-modules

반응형