Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 3ae97f2

Browse files
committed
Update vuex-store.md
1 parent 419184d commit 3ae97f2

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

es/guide/vuex-store.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ export const mutations = {
7070

7171
Then, you can have a `store/todos.js` file:
7272
```js
73-
export const state = {
73+
export const state = () => ({
7474
list: []
75-
}
75+
})
7676

7777
export const mutations = {
7878
add (state, text) {

fr/guide/vuex-store.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ Nous pouvons alors utiliser `this.$store` dans nos composants:
5555
Si vous voulez cette option, exportez le `state`, les mutations et les actions dans `store/index.js` au lieu de l'instance `store`:
5656

5757
```js
58-
export const state = {
58+
export const state = () => ({
5959
counter: 0
60-
}
60+
})
6161

6262
export const mutations = {
6363
increment (state) {
@@ -68,9 +68,9 @@ export const mutations = {
6868

6969
Puis, vous pouvez avoir `store/todos.js`:
7070
```js
71-
export const state = {
71+
export const state = () => ({
7272
list: []
73-
}
73+
})
7474

7575
export const mutations = {
7676
add (state, text) {

ja/guide/vuex-store.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export default store
5757
このオプションを使いたいときは、ストアインスタンスの代わりに、`store/index.js` 内でストア、ミューテーション、アクションをエクスポートします:
5858

5959
```js
60-
export const state = {
60+
export const state = () => ({
6161
counter: 0
62-
}
62+
})
6363

6464
export const mutations = {
6565
increment (state) {
@@ -71,9 +71,9 @@ export const mutations = {
7171
また、次のような `store/todos.js` ファイルを作成できます:
7272

7373
```js
74-
export const state = {
74+
export const state = () => ({
7575
list: []
76-
}
76+
})
7777

7878
export const mutations = {
7979
add (state, text) {

ko/guide/vuex-store.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export default store
5656
만약 모듈 모드를 원한다면 `store/index.js` 파일에 store 인스턴스 대신 state와 mutaions, actions를 export 합니다:
5757

5858
```js
59-
export const state = {
59+
export const state = () => ({
6060
counter: 0
61-
}
61+
})
6262

6363
export const mutations = {
6464
increment (state) {
@@ -69,9 +69,9 @@ export const mutations = {
6969

7070
이제 `store/todos.js` 파일을 만들 수 있습니다:
7171
```js
72-
export const state = {
72+
export const state = () => ({
7373
list: []
74-
}
74+
})
7575

7676
export const mutations = {
7777
add (state, text) {

ru/guide/vuex-store.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export default store
5757
Если вы хотите использовать этот подход, экспортируйте в `store/index.js` состояние, мутации и действия, а не экземпляр хранилища:
5858

5959
```js
60-
export const state = {
60+
export const state = () => ({
6161
counter: 0
62-
}
62+
})
6363

6464
export const mutations = {
6565
increment (state) {
@@ -70,9 +70,9 @@ export const mutations = {
7070

7171
Предположим, у нас есть модуль `store/todos.js`:
7272
```js
73-
export const state = {
73+
export const state = () => ({
7474
list: []
75-
}
75+
})
7676

7777
export const mutations = {
7878
add (state, text) {

zh/guide/vuex-store.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ export default store
5959
使用**状态树模块化**的方式,`store/index.js` 不需要返回 Vuex.Store 实例,而应该直接将 `state``mutations``actions` 暴露出来:
6060

6161
```js
62-
export const state = {
62+
export const state = () => ({
6363
counter: 0
64-
}
64+
})
6565

6666
export const mutations = {
6767
increment (state) {
@@ -73,9 +73,9 @@ export const mutations = {
7373
其他的模块文件也需要采用类似的方式,如 `store/todos.js` 文件:
7474

7575
```js
76-
export const state = {
76+
export const state = () => ({
7777
list: []
78-
}
78+
})
7979

8080
export const mutations = {
8181
add (state, text) {

0 commit comments

Comments
 (0)