mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
20 lines
455 B
TypeScript
20 lines
455 B
TypeScript
import { useStore } from 'vuex'
|
|
import throttle from 'lodash/throttle'
|
|
import { State, ActionTypes } from '@/store'
|
|
|
|
export default () => {
|
|
const store = useStore<State>()
|
|
|
|
const redo = throttle(function() {
|
|
store.dispatch(ActionTypes.RE_DO)
|
|
}, 100, { leading: true, trailing: false })
|
|
|
|
const undo = throttle(function() {
|
|
store.dispatch(ActionTypes.UN_DO)
|
|
}, 100, { leading: true, trailing: false })
|
|
|
|
return {
|
|
redo,
|
|
undo,
|
|
}
|
|
} |