model.js 615 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { getElementId, randomCode } from "../../plugins/utils";
  2. const LINE_HORIZONTAL = {
  3. type: "LINE_HORIZONTAL",
  4. x: 0,
  5. y: 0,
  6. w: 300,
  7. h: 30,
  8. sign: "",
  9. bold: "1px",
  10. color: "#000000",
  11. style: "solid"
  12. };
  13. // 竖线
  14. const LINE_VERTICAL = {
  15. type: "LINE_VERTICAL",
  16. x: 0,
  17. y: 0,
  18. w: 30,
  19. h: 300,
  20. sign: "",
  21. bold: "1px",
  22. color: "#000000",
  23. style: "solid"
  24. };
  25. const getModel = type => {
  26. const model = type === "HORIZONTAL" ? LINE_HORIZONTAL : LINE_VERTICAL;
  27. return {
  28. id: getElementId(),
  29. key: randomCode(),
  30. ...model
  31. };
  32. };
  33. export { LINE_HORIZONTAL, LINE_VERTICAL, getModel };