Vuex Tutorial #8 - Mapping Actions & Getters > JS프레임워크

JS프레임워크

Vuex Tutorial #8 - Mapping Actions & Getters 정보

Vue Vuex Tutorial #8 - Mapping Actions & Getters

본문

Mapping Actions & Getters  

 

...을 지원하기 위해서 

npm install babel-preset-stage-2 --save-dev

 

.babelrc에

["stage-2"] 추가

 

import {mapActions } from 'vuex';

import {mapGetters } from 'vuex';

 

saleProducts(){

  return this.$store.getters.saleProducts;

}

가 아래로

...mapGetters([

  'saleProducts'

])

 

reducePrice: function(amount) {

  this.$store.dispatch('reducePrice', amount)

}

가 아래로 (amount는 자동으로??)

...mapActions([

  'reducePrice'

])

 

https://github.com/iamshaunjp/vuex-playlist/tree/lesson-08

 

추천
0
  • 복사

댓글 0개

© SIRSOFT
현재 페이지 제일 처음으로