component.tsx 959 B

1234567891011121314151617181920212223242526272829303132
  1. import { string } from "vue-types";
  2. import { useCompData } from ".";
  3. import { useEditor } from "../../../../..";
  4. import { Image, Text } from "../../../basicUI";
  5. import { createUIComp } from "../../../defines/createUIComp";
  6. export const Component = createUIComp({
  7. props: {
  8. compId: string().isRequired,
  9. },
  10. setup(props) {
  11. const { designToNaturalSize } = useEditor().helper;
  12. const { children } = useCompData(props.compId);
  13. return () => (
  14. <div class="relative w-full">
  15. <div class="!absolute w-full h-full flex justify-center items-center">
  16. <Text.Component class="!absolute w-full" compId={children.text1} />
  17. </div>
  18. <div class="flex justify-center">
  19. <Image.Component
  20. style={{
  21. width: designToNaturalSize(368),
  22. height: designToNaturalSize(275),
  23. }}
  24. compId={children.bgImg}
  25. />
  26. </div>
  27. </div>
  28. );
  29. },
  30. });