event-dialog load schema

This commit is contained in:
zude.hzd 2020-07-16 21:21:27 +08:00
parent 199ed2b9cd
commit 9d6db96b05

View File

@ -5,21 +5,21 @@ import './index.scss';
export default class EventBindDialog extends Component<PluginProps> { export default class EventBindDialog extends Component<PluginProps> {
private eventList: any[] = [ private eventList: any[] = [
{ // {
name: 'getData', // name: 'getData',
}, // },
{ // {
name: 'deleteData', // name: 'deleteData',
}, // },
{ // {
name: 'initData', // name: 'initData',
}, // },
{ // {
name: 'editData', // name: 'editData',
}, // },
{ // {
name: 'submitData', // name: 'submitData',
}, // },
]; ];
state: any = { state: any = {
@ -41,10 +41,23 @@ export default class EventBindDialog extends Component<PluginProps> {
}); });
}; };
componentDidMount() { componentDidMount() {
const { editor, config } = this.props; const { editor, config } = this.props;
editor.on(`${config.pluginKey}.openDialog`, (bindEventName: String) => { editor.on(`${config.pluginKey}.openDialog`, (bindEventName: String) => {
this.openDialog(bindEventName); this.openDialog(bindEventName);
let schema = editor.get('designer').project.getSchema();
let pageNode = schema.componentsTree[0];
if (pageNode.methods){
for (let key in pageNode.methods){
this.eventList.push({
name:key
})
}
}
}); });
} }