index.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { Dict_Imgs } from "@/dict";
  2. import { createAttrsForm } from "../../defines/createAttrsForm";
  3. import { createCompHooks } from "../../defines/createCompHooks";
  4. export { Component } from "./component";
  5. export const options = {
  6. name: "图片",
  7. thumbnail: require("@/modules/editor/assets/icons/image.svg"),
  8. };
  9. export const { createComp, useCompData } = createCompHooks({
  10. value: {
  11. url: Dict_Imgs.Default,
  12. x: 0,
  13. y: 0,
  14. s: 1,
  15. showLink: false,
  16. link: "",
  17. },
  18. layout: {
  19. size: [750, 400],
  20. },
  21. });
  22. export const Form = createAttrsForm([
  23. // {
  24. // label: "图片",
  25. // dataIndex: "value.url",
  26. // component: "Input",
  27. // },
  28. // {
  29. // label: "x偏移",
  30. // dataIndex: "value.x",
  31. // component: "Input",
  32. // },
  33. // {
  34. // label: "y偏移",
  35. // dataIndex: "value.y",
  36. // component: "Input",
  37. // },
  38. // {
  39. // label: "缩放",
  40. // dataIndex: "value.s",
  41. // component: "Input",
  42. // },
  43. {
  44. label: "添加链接",
  45. dataIndex: "value.showLink",
  46. component: "Switch",
  47. },
  48. {
  49. dataIndex: "value.link",
  50. component: "Input",
  51. props: {
  52. placeholder: "http://",
  53. },
  54. isVisible: (value, data) => data?.value?.showLink == true,
  55. },
  56. ]);