mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix event bug
This commit is contained in:
parent
5d32215b1b
commit
ddaf8b66ff
@ -19,12 +19,14 @@
|
||||
"value": "function() {\n \t\tconsole.log('will umount');\n\t}"
|
||||
}
|
||||
},
|
||||
|
||||
"methods": {
|
||||
"testFunc": {
|
||||
"type": "JSFunction",
|
||||
"value": "function() { console.log('test func');}"
|
||||
"value": "function() {console.log('test func');}"
|
||||
}
|
||||
},
|
||||
|
||||
"props": {
|
||||
"ref": "outterView",
|
||||
"autoLoading": true,
|
||||
|
||||
@ -268,9 +268,19 @@ export default class EventsSetter extends Component<{
|
||||
|
||||
onRelatedEventNameClick = (eventName:String) => {
|
||||
const {editor} = this.props.field;
|
||||
editor.emit('sourceEditor.focusByFunction',{
|
||||
functionName:eventName
|
||||
})
|
||||
|
||||
editor.get('skeleton').getPanel('sourceEditor').show();
|
||||
|
||||
setTimeout(()=>{
|
||||
editor.emit('sourceEditor.focusByFunction',{
|
||||
functionName:eventName
|
||||
})
|
||||
},300)
|
||||
|
||||
|
||||
// editor.emit('sourceEditor.focusByFunction',{
|
||||
// functionName:eventName
|
||||
// })
|
||||
}
|
||||
|
||||
closeEventMenu = () => {
|
||||
@ -324,6 +334,7 @@ export default class EventsSetter extends Component<{
|
||||
eventDataList
|
||||
})
|
||||
|
||||
|
||||
this.props.onChange(eventDataList);
|
||||
|
||||
//this.closeDialog();
|
||||
|
||||
@ -99,16 +99,6 @@ export default class SourceEditor extends Component<{
|
||||
//});
|
||||
}
|
||||
|
||||
componentDidMount() {}
|
||||
|
||||
openPluginPannel = () => {
|
||||
const { editor } = this.props;
|
||||
// 判断面板是否处于激活状态
|
||||
if (!editor.leftNav || editor.leftNav != 'sourceEditor') {
|
||||
// 打开面板
|
||||
editor.emit('leftNav.change', 'sourceEditor');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑器事件
|
||||
@ -122,7 +112,6 @@ export default class SourceEditor extends Component<{
|
||||
return;
|
||||
}
|
||||
|
||||
debugger;
|
||||
if (this.state.selectTab == TAB_KEY.CSS_TAB) {
|
||||
this.setState({
|
||||
selectTab: TAB_KEY.JS_TAB,
|
||||
@ -173,7 +162,6 @@ export default class SourceEditor extends Component<{
|
||||
this.monocoEditor.focus();
|
||||
}, 100);
|
||||
|
||||
debugger;
|
||||
|
||||
this.updateCode(this.monocoEditor.getModel().getValue());
|
||||
}
|
||||
@ -213,6 +201,10 @@ export default class SourceEditor extends Component<{
|
||||
}
|
||||
|
||||
onTabChange = (key) => {
|
||||
const { editor } = this.props;
|
||||
let schema = editor.get('designer').project.getSchema();
|
||||
console.log(schema);
|
||||
|
||||
this.setState({
|
||||
selectTab: key,
|
||||
});
|
||||
|
||||
@ -59,7 +59,15 @@ const transfrom = {
|
||||
|
||||
setFunction2Schema(functionMap,schema){
|
||||
let pageNode = schema.componentsTree[0];
|
||||
pageNode.state = functionMap.state;
|
||||
for (let key in functionMap){
|
||||
if (key == 'state'){
|
||||
pageNode.state = functionMap[key];
|
||||
}else{
|
||||
if (LIFECYCLES_FUNCTION_MAP.react.indexOf(key)>=0){
|
||||
// 判断有没有lifecycles节点
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@ -104,7 +112,7 @@ function initMethodsCode(componentSchema: Object) {
|
||||
}
|
||||
|
||||
function createFunctionCode(functionName: String, functionNode: Object) {
|
||||
if (functionNode.type === 'JSExpression') {
|
||||
if (functionNode.type === 'JSExpression' || functionNode.type === 'JSFunction') {
|
||||
let functionCode = functionNode.value;
|
||||
functionCode = functionCode.replace(/function/, functionName);
|
||||
return functionCode;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user