amao-schema-editor
v2.0.3
Published
Downloads
7
Readme
schema-editor
发布请执行 tnpm run pub
使用 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'));