1 개요[ | ]
- Vuex mapMutations
- "컴포넌트 안에서 변이 커밋하기"
this.$store.commit('xxx')
를 사용하여 컴포넌트에서 변이를 수행하거나 컴포넌트 메소드를store.commit
호출에 매핑하는 헬퍼 (단, 루트 store 주입 필요)
JavaScript
Copy
import { mapMutations } from 'vuex'
export default {
// ...
methods: {
...mapMutations([
'increment' // this.increment()를 this.$store.commit('increment')에 매핑한다.
]),
...mapMutations({
add: 'increment' // this.add()를 this.$store.commit('increment')에 매핑한다.
})
}
}
2 같이 보기[ | ]
3 참고[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.