index.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. offsetUnit: "%",
  17. link: "",
  18. },
  19. layout: {
  20. size: [750, 400],
  21. },
  22. });
  23. export const Form = createAttrsForm([
  24. // {
  25. // label: "图片",
  26. // dataIndex: "value.url",
  27. // component: "Input",
  28. // },
  29. // {
  30. // label: "x偏移",
  31. // dataIndex: "value.x",
  32. // component: "Input",
  33. // },
  34. // {
  35. // label: "y偏移",
  36. // dataIndex: "value.y",
  37. // component: "Input",
  38. // },
  39. // {
  40. // label: "缩放",
  41. // dataIndex: "value.s",
  42. // component: "Input",
  43. // },
  44. {
  45. label: "添加链接",
  46. dataIndex: "value.showLink",
  47. component: "Switch",
  48. },
  49. {
  50. dataIndex: "value.link",
  51. component: "Input",
  52. props: {
  53. placeholder: "http://",
  54. },
  55. isVisible: (value, data) => data?.value?.showLink == true,
  56. },
  57. ]);