index.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { createAttrsForm } from "../../defines/createAttrsForm";
  2. import { createCompHooks } from "../../defines/createCompHooks";
  3. export { Component } from "./component";
  4. export const options = {
  5. name: "视频",
  6. thumbnail: require("@/modules/editor/assets/icons/video.svg"),
  7. };
  8. export const { createComp, useCompData } = createCompHooks({
  9. value: {
  10. url: "//infishwaibao.oss-cn-chengdu.aliyuncs.com/release/sku3d/media/shoes.1c5c29ad.webm",
  11. ratio: 1,
  12. autoplay: true,
  13. loop: true,
  14. controls: true,
  15. },
  16. layout: {
  17. size: [750, 750],
  18. },
  19. });
  20. export const Form = createAttrsForm([
  21. {
  22. label: "视频地址",
  23. dataIndex: "value.url",
  24. component: "Input",
  25. },
  26. {
  27. label: "视频比例",
  28. dataIndex: "value.ratio",
  29. component: "Select",
  30. props: {
  31. options: [
  32. { label: "1:1", value: 1 },
  33. { label: "4:3", value: 4 / 3 },
  34. { label: "3:4", value: 3 / 4 },
  35. { label: "16:9", value: 16 / 9 },
  36. { label: "9:16", value: 9 / 16 },
  37. ],
  38. },
  39. },
  40. {
  41. label: "自动播放",
  42. dataIndex: "value.autoplay",
  43. component: "Switch",
  44. },
  45. {
  46. label: "循环播放",
  47. dataIndex: "value.loop",
  48. component: "Switch",
  49. },
  50. {
  51. label: "显示控制器",
  52. dataIndex: "value.controls",
  53. component: "Switch",
  54. },
  55. ]);