https://www.yuque.com/form/reactflow/leva
LevaPanenl 属性配置 https://pro-editor.antdigital.dev/components/leva-panel

LevaPanel

image.png

  1. import { useState } from 'react';
  2. import { LevaPanel } from '@ant-design/pro-editor';
  3. import type { JSONSchema } from '@ant-design/pro-editor';
  4. interface IProps {
  5. schema: JSONSchema;
  6. title: string;
  7. }
  8. function Panel(props: IProps) {
  9. const {
  10. title,
  11. schema
  12. } = props;
  13. const [config, setConfig] = useState<JSONSchema>({});
  14. return (
  15. <LevaPanel
  16. schema={schema}
  17. title={title}
  18. value={config}
  19. onChange={(changedValue, allValue) => {
  20. setConfig(allValue);
  21. console.log('check changedValue:', {changedValue, allValue });
  22. }}
  23. />
  24. );
  25. }
  26. export default Panel;