mirror of
https://github.com/r-ca/kidshift-web.git
synced 2024-10-25 16:34:01 +00:00
store作成
This commit is contained in:
parent
c13484d9a7
commit
121046c0c0
11
src/store/cache/actions.ts
vendored
Normal file
11
src/store/cache/actions.ts
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { ActionTree } from 'vuex';
|
||||
import { StateInterface } from '../index';
|
||||
import { ExampleStateInterface } from './state';
|
||||
|
||||
const actions: ActionTree<ExampleStateInterface, StateInterface> = {
|
||||
someAction (/* context */) {
|
||||
// your code
|
||||
}
|
||||
};
|
||||
|
||||
export default actions;
|
11
src/store/cache/getters.ts
vendored
Normal file
11
src/store/cache/getters.ts
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { GetterTree } from 'vuex';
|
||||
import { StateInterface } from '../index';
|
||||
import { ExampleStateInterface } from './state';
|
||||
|
||||
const getters: GetterTree<ExampleStateInterface, StateInterface> = {
|
||||
someGetter (/* context */) {
|
||||
// your code
|
||||
}
|
||||
};
|
||||
|
||||
export default getters;
|
16
src/store/cache/index.ts
vendored
Normal file
16
src/store/cache/index.ts
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { Module } from 'vuex';
|
||||
import { StateInterface } from '../index';
|
||||
import state, { ExampleStateInterface } from './state';
|
||||
import actions from './actions';
|
||||
import getters from './getters';
|
||||
import mutations from './mutations';
|
||||
|
||||
const exampleModule: Module<ExampleStateInterface, StateInterface> = {
|
||||
namespaced: true,
|
||||
actions,
|
||||
getters,
|
||||
mutations,
|
||||
state
|
||||
};
|
||||
|
||||
export default exampleModule;
|
10
src/store/cache/mutations.ts
vendored
Normal file
10
src/store/cache/mutations.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { MutationTree } from 'vuex';
|
||||
import { ExampleStateInterface } from './state';
|
||||
|
||||
const mutation: MutationTree<ExampleStateInterface> = {
|
||||
someMutation (/* state: ExampleStateInterface */) {
|
||||
// your code
|
||||
}
|
||||
};
|
||||
|
||||
export default mutation;
|
11
src/store/cache/state.ts
vendored
Normal file
11
src/store/cache/state.ts
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
export interface ExampleStateInterface {
|
||||
prop: boolean;
|
||||
}
|
||||
|
||||
function state(): ExampleStateInterface {
|
||||
return {
|
||||
prop: false,
|
||||
};
|
||||
}
|
||||
|
||||
export default state;
|
Loading…
Reference in New Issue
Block a user