init.ts 804 B

1234567891011121314151617181920212223242526272829
  1. import { Exception } from "queenjs";
  2. import { EditorModule } from "..";
  3. import { DesignTemp } from "../defines/DesignTemp";
  4. import { editActions } from "./edit";
  5. import { EditorMode } from "../typings";
  6. export const initActions = EditorModule.action({
  7. // 模块初始化
  8. init() {
  9. const { historyCtrl } = this.controls;
  10. historyCtrl.proxyActions(Object.keys(editActions));
  11. // createProxyEffect(this.store, (type, paths, value) => {
  12. // historyCtrl.onChange(this.store, type, paths, value);
  13. // });
  14. this.actions.initInputEvent();
  15. },
  16. // 初始化数据
  17. async initDesign(id: string) {
  18. const ret = await this.https.getDesignDetail(id);
  19. this.store.initDesignData(ret.result);
  20. },
  21. // 切换模式
  22. switchMode(v: EditorMode) {
  23. this.store.setMode(v);
  24. },
  25. });