SaveOrShare.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { useEditor } from "@/modules/editor";
  2. import { Button, Dropdown } from "ant-design-vue";
  3. import { defineUI, queenApi } from "queenjs";
  4. import { TipIcons } from "../../TipIcons";
  5. import PreviewDesignModal from "./PreviewDesignModal";
  6. import { ShareBox } from "./ShareBox";
  7. export default defineUI({
  8. setup() {
  9. const editor = useEditor();
  10. const { store, actions, controls } = editor;
  11. function showPreviewModal() {
  12. controls.screenCtrl.saveScreenPage();
  13. const rootPage = controls.pageCtrl.rootPage;
  14. rootPage.value.pageMode = controls.screenCtrl.state.screen.pageMode;
  15. rootPage.value.pageSizeType =
  16. controls.screenCtrl.state.screen.pageSizeType;
  17. queenApi.dialog(
  18. <PreviewDesignModal data={controls.pageCtrl.designData} />,
  19. {
  20. fullscreen: true,
  21. closable: false,
  22. }
  23. );
  24. }
  25. return () => (
  26. <aside class="space-x-16px flex items-center">
  27. <TipIcons.Preview
  28. class="text-20px text-light-50 bg-dark-50 p-6px transform rotate-90 rounded cursor-pointer transition hover:(!bg-dark-100)"
  29. onClick={showPreviewModal}
  30. />
  31. {store.isEditPage && (
  32. <Dropdown
  33. overlay={<ShareBox />}
  34. trigger="click"
  35. placement="bottomRight"
  36. >
  37. <Button
  38. type="default"
  39. class="text-12px bg-dark-50 hover:(bg-dark-100 border-transparent text-light-50)"
  40. >
  41. 分享
  42. </Button>
  43. </Dropdown>
  44. )}
  45. <Button
  46. class="text-12px text-dark-500 hover:text-dark-500"
  47. type="primary"
  48. onClick={() => actions.saveDesign()}
  49. >
  50. 保存
  51. </Button>
  52. </aside>
  53. );
  54. },
  55. });