-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
123 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
"modules": false, | ||
"targets": { | ||
"chrome": "58", | ||
"ie": "9" | ||
"ie": "11" | ||
} | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { VUEX_NS, editorHelper as helper, commit } from './index' | ||
import { Tstore } from '@types' | ||
|
||
export const actions = helper.makeActions({ | ||
TEST_ACTION(ctx, { id, version }: { id: number } & Pick<Tstore.state, 'version'>) { | ||
let resove | ||
const promise = new Promise((res) => resove = res) | ||
setTimeout(() => { | ||
console.log('timeout!') | ||
commit(ctx, 'TEST_VERSION', { version }) | ||
resove() | ||
}, 1000) | ||
return promise | ||
} | ||
}) | ||
|
||
export default actions | ||
|
||
export type TActions = typeof actions | ||
|
||
export const dispatch = helper.createDispatch<Tstore.Actions[VUEX_NS]>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export default { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
export const VUEX_NS = 'editor' | ||
export type VUEX_NS = typeof VUEX_NS | ||
export * from './type' | ||
|
||
import Vue from 'vue' | ||
import Vuex from 'vuex' | ||
import actions, { dispatch } from './actions' | ||
import mutations, { commit, getState } from './mutations' | ||
import getters from './getters' | ||
import state from './state' | ||
|
||
Vue.use(Vuex) | ||
|
||
export default { | ||
namespaced: true, | ||
state: state(), | ||
actions, | ||
mutations, | ||
getters, | ||
} | ||
|
||
export { commit, getState, dispatch } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { VUEX_NS, editorHelper as helper } from './index' | ||
import { Tstore } from '@types' | ||
|
||
export const mutations = helper.makeMutations({ | ||
TEST_VERSION: (state, { version }: Pick<Tstore.state, 'version'>) => { | ||
state.test = version | ||
}, | ||
}) | ||
|
||
export default mutations | ||
|
||
export type TMutations = typeof mutations | ||
|
||
export const commit = helper.createCommit<Tstore.Mutations[VUEX_NS]>() | ||
export const getState = helper.createGetState() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Tstore } from '@types' | ||
|
||
export default function state(): Tstore.state['editor'] { | ||
return { | ||
test: 'vuex 初始化 string' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Tstore } from '@types' | ||
import { makeWrapper } from 'src/store/helpers' | ||
|
||
export const VUEX_NS = 'editor' | ||
export type VUEX_NS = typeof VUEX_NS | ||
|
||
export const editorHelper = makeWrapper<Tstore.state[VUEX_NS], Tstore.getters[VUEX_NS]>(VUEX_NS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.