|
3 | 3 | */ |
4 | 4 |
|
5 | 5 | import Vuex from 'vuex' |
6 | | -import { State, Getter, Mutation, Action, namespace } from 'vuex-class' |
7 | 6 | import keymirror from '../utils/keymirror' |
8 | | -import { getter, mutation, action, decorator } from '../utils/vuexUtil' |
9 | 7 |
|
| 8 | +import { |
| 9 | + State as vState, |
| 10 | + Getter as vGetter, |
| 11 | + Mutation as vMutation, |
| 12 | + Action as vAction, |
| 13 | + namespace |
| 14 | +} from 'vuex-class' |
| 15 | + |
| 16 | +import { |
| 17 | + getter, |
| 18 | + mutation, |
| 19 | + action, |
| 20 | + decorator |
| 21 | +} from '../utils/vuexUtil' |
| 22 | + |
| 23 | +const storeName = 'todo' |
10 | 24 | const STORE_KEY = 'vue-typescript-todos' |
11 | 25 |
|
12 | 26 | /*** state ***/ |
@@ -115,18 +129,9 @@ export let types = { |
115 | 129 | action: keymirror(actions) |
116 | 130 | } |
117 | 131 |
|
118 | | -export let module = { |
119 | | - State: namespace('todo', State), |
120 | | - Getter: namespace('todo', Getter), |
121 | | - Mutation: namespace('todo', Mutation), |
122 | | - Action: namespace('todo', Action) |
123 | | -} |
124 | | - |
125 | | -export let Store = { |
126 | | - state: decorator(module.State, types.state), |
127 | | - getter: decorator(module.Getter, types.getter), |
128 | | - mutation: decorator(module.Mutation, types.mutation), |
129 | | - action: decorator(module.Action, types.action), |
130 | | -} |
| 132 | +export let State = decorator(namespace(storeName, vState), types.state) |
| 133 | +export let Getter = decorator(namespace(storeName, vGetter), types.getter) |
| 134 | +export let Mutation = decorator(namespace(storeName, vMutation), types.mutation) |
| 135 | +export let Action = decorator(namespace(storeName, vAction), types.action) |
131 | 136 |
|
132 | 137 | export default store |
0 commit comments