schema-editor

1.0.7 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i schema-editor

Weekly Downloads

4

Version

1.0.7

License

ISC

Last publish

Collaborators

  • shepherdwind