ShareBox.tsx 957 B

1234567891011121314151617181920212223242526272829
  1. import { useEditor } from "@/modules/editor";
  2. import { useQRCode } from "@vueuse/integrations/useQRCode";
  3. import { useClipboard } from "@vueuse/core";
  4. import { Button } from "ant-design-vue";
  5. import { defineComponent } from "vue";
  6. export const ShareBox = defineComponent({
  7. setup() {
  8. const { store } = useEditor();
  9. let shareLink =
  10. location.origin + "/share.html?id=" + store.designData._id;
  11. if (location.host == "www.infish.cn") {
  12. shareLink = location.origin + "/projects/queenshow/share.html?id=" + store.designData._id;
  13. }
  14. const qrUrl = useQRCode(shareLink);
  15. const { copy, copied } = useClipboard();
  16. return () => (
  17. <div class="p-20px bg-dark-500 text-center">
  18. <img src={qrUrl.value} />
  19. <div class="mb-20px"></div>
  20. <Button onClick={() => copy(shareLink)} disabled={copied.value}>
  21. {copied.value ? "已复制" : "复制链接"}
  22. </Button>
  23. </div>
  24. );
  25. },
  26. });