반응형
Vuex에서 namesthed mapGetter의 이름을 변경하는 방법
인마이nuxt
사용하려는 프로젝트mapGetters
rename object 구문을 사용합니다(문서 참조).getters는 모듈 내에서 네임슬레이징됩니다.currentTournament
.
다음은 믹스인 내에서 계산된 속성입니다.
computed: {
...mapGetters('currentTournament', [{ tAllowedBaskets: 'allowedBaskets' }]),
}
컴포넌트를 로그에 기록하면this
, 대신tAllowedBaskets
새 속성이 나타나는 속성[object Object]: undefined
단, 'simple' 문자열 구문을 사용하는 경우:
...mapGetters('currentTournament', ['allowedBaskets'])
allowedBaskets
속성이 올바르게 표시됩니다.
오브젝트 구문이 작동하지 않는 이유는 무엇입니까?
적절한 구문은 다음과 같습니다.
...mapGetters('currentTournament', { tAllowedBaskets: 'allowedBaskets' }),
대괄호는 필요 없습니다.[]
vuex 설명서의 이 부분에 나와 있는 바와 같이
언급URL : https://stackoverflow.com/questions/69076488/how-to-rename-a-namespaced-mapgetter-in-vuex
반응형
'programing' 카테고리의 다른 글
arrayList.toArray()가 보다 구체적인 유형을 반환하도록 합니다. (0) | 2022.06.03 |
---|---|
중첩된 데이터와 v-slot이 있는 데이터 테이블 Vuetify: 항목 (0) | 2022.06.03 |
SVG가 vue-svg-loader를 로드하고 있습니다.[ Vue warn ] :잘못된 구성 요소 정의 (0) | 2022.06.03 |
집합을 목록으로 변환하는 가장 간결한 방법 (0) | 2022.06.03 |
Vuex의 다른 작업 내에서 작업을 디바운스할 수 없음 (0) | 2022.06.03 |