티스토리 뷰
What is Vuex? | Vuex (vuejs.org)
What is Vuex? | Vuex
What is Vuex? Pinia is now the new default The official state management library for Vue has changed to Pinia. Pinia has almost the exact same or enhanced API as Vuex 5, described in Vuex 5 RFC. You could simply consider Pinia as Vuex 5 with a different na
vuex.vuejs.org
Vue.use(Vuex);
export default new Vuex.store({
state: {
}
})
...
state -> 저장소
mutations -> 함수안에서 state에 접근해 값을 수정함 ,,, this.$store.commit('원하는 함수 이름', 파라미터)
actions -> '비동기 작업' 후 state에 반영할때 ,,, this$.store.dispatch('action 이름' , 파라미터)
getters -> computed와 비슷, 바로 계산 값을 가져옴 ,,, this.$store.getters.'vuex getters 이름'
map 헬퍼 -> vuex의 값을 알아서 computed에 mapping함 ,,, ...mapState([ 'a' , 'b' ]) / ({ replace : 'a' }) 가능
Vuex Modules -> 관련된 로직을 뺴내 모듈화 -> this.$store.모듈이름.
export default new Vuex.store({
state: {
},
module: {
module1,
module2,
}
})
module에는 namespace 추가
getters -> this.$store.getters['module이름/getters']
disptch -> this.$store.dispatch('module이름/getters',파라미터)
commit-> this.$store.commit('module이름/getters',파라미터)
...mapState([ 'a' : state => state.모듈.a ])
'프론트엔드 > Vue.js' 카테고리의 다른 글
vuetify icon 확인 사이트 (0) | 2022.11.03 |
---|---|
[vue] package.json 과 package-lock.json (0) | 2022.11.02 |
[VUE] No Babel config file detected (0) | 2022.10.31 |
vue.js v-html을 이용한 문자열에서 특정 글자색 바꾸기 (0) | 2022.10.12 |
<업무 오류> Vue.js 삭제된 instance가 다시 부활함... (0) | 2022.08.03 |
- Total
- Today
- Yesterday
- react 3d
- react 3d text
- react 3d animation
- eslint
- react three fiber
- webpack glsl
- [leetcode] 394. decode string
- react three fiber leva
- ts glsl
- react 3d 에니메이션
- vue
- vue react
- leva
- Vue.js
- [leetcode] 394. decode string js
- three.js leva
- vue ref
- 394. decode string js
- next.js import glsl
- attempted import error: bvh_struct_definitions' is not exported from './gpu/bvhshaderglsl.js' (imported as 'bvhshaderglsl').
- 394. decode string javascript
- react fiber 3d
- typescript gsls
- 394 decode string
- vue reactive
- vue3
- react glsl
- react leva
- react vue
- react ref reative
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |