component.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 flex justify-between">
  15. <div class="flex flex-col justify-center">
  16. <Text.Component compId={children.text1} />
  17. <Text.Component class="mt-0.07rem" compId={children.text2} />
  18. <div class="flex justify-between mt-0.07rem">
  19. <Image.Component
  20. class="rounded-1/2 overflow-hidden"
  21. style={{
  22. width: designToNaturalSize(51),
  23. height: designToNaturalSize(51),
  24. }}
  25. compId={children.item1}
  26. />
  27. <Image.Component
  28. class="rounded-1/2 overflow-hidden"
  29. style={{
  30. width: designToNaturalSize(51),
  31. height: designToNaturalSize(51),
  32. }}
  33. compId={children.item2}
  34. />
  35. <Image.Component
  36. class="rounded-1/2 overflow-hidden"
  37. style={{
  38. width: designToNaturalSize(51),
  39. height: designToNaturalSize(51),
  40. }}
  41. compId={children.item3}
  42. />
  43. </div>
  44. </div>
  45. <Image.Component
  46. class="overflow-hidden"
  47. style={{
  48. width: designToNaturalSize(317),
  49. height: designToNaturalSize(240),
  50. }}
  51. compId={children.bgImg}
  52. />
  53. </div>
  54. );
  55. },
  56. });