node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

schema-editor

schema-editor

使用 demo

const schemaUtil = require('schema-util');
const React = require('react');
const ReactDOM = require('react-dom');
const Editor = require('@alipay/schema-editor');
 
class Demo extends React.Component {
 
  onChange(data, fields) {
    console.log(data, fields);
  }
 
  render() {
    const schema = schemaUtil.schema(`
      Object(大牌劲爆商品) {
        title(标题),
        list(商品列表): Array {
          href(宝贝链接),
          title(标题),
          img(图片地址[272x272]): Image,
          price(花呗价格),
          origin(原价),
          count(折扣)
        }
      }
    `);
    const data = schemaUtil.mock(schema);
 
    return <Editor data={JSON.parse(data)} schema={schema} onChange={this.onChange} />;
  }
}
 
ReactDOM.render(<Demo />, document.querySelector('.view-box'));

TODO

  • 上传图片接口配置
  • excel 导入导出功能配置
  • 校验逻辑
  • 自定义 field