mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 17:48:13 +00:00
Merge branch 'feat/rax-miniapp' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into feat/rax-miniapp
This commit is contained in:
commit
8029905ffd
@ -137,7 +137,19 @@ designer.addPropsReducer((props, node) => {
|
||||
}, TransformStage.Init);
|
||||
|
||||
designer.addPropsReducer((props: any, node: Node) => {
|
||||
// live 模式下解析 lifeCycles
|
||||
if (node.isRoot() && props && props.lifeCycles) {
|
||||
if (editor.get('designMode') === 'live') {
|
||||
const lifeCycleMap = {
|
||||
didMount: 'componentDidMount',
|
||||
willUnmount: 'componentWillUnMount',
|
||||
};
|
||||
const lifeCycles = props.lifeCycles;
|
||||
Object.keys(lifeCycleMap).forEach(key => {
|
||||
lifeCycles[lifeCycleMap[key]] = lifeCycles[key];
|
||||
});
|
||||
return props;
|
||||
}
|
||||
return {
|
||||
...props,
|
||||
lifeCycles: {},
|
||||
@ -219,6 +231,29 @@ designer.addPropsReducer((props: any, node: Node) => {
|
||||
return props;
|
||||
}, TransformStage.Save);
|
||||
|
||||
// designer.addPropsReducer((props: any, node: Node) => {
|
||||
// const lifeCycleNames = ['didMount', 'willUnmount'];
|
||||
// const lifeCycleMap = {
|
||||
// didMount: 'componentDidMount',
|
||||
// willUnmount: 'componentWillUnMount',
|
||||
// };
|
||||
// if (node.componentName === 'Page') {
|
||||
// debugger;
|
||||
// lifeCycleNames.forEach(key => {
|
||||
// if (props[key]) {
|
||||
// const lifeCycles = node.props.getPropValue(getConvertedExtraKey('lifeCycles')) || {};
|
||||
// lifeCycles[lifeCycleMap[key]] = props[key];
|
||||
// node.props.setPropValue(getConvertedExtraKey('lifeCycles'), lifeCycles);
|
||||
// } else if (node.props.getPropValue(getConvertedExtraKey('lifeCycles'))) {
|
||||
// const lifeCycles = node.props.getPropValue(getConvertedExtraKey('lifeCycles')) || {};
|
||||
// lifeCycles[lifeCycleMap[key]] = lifeCycles[key];
|
||||
// node.props.setPropValue(getConvertedExtraKey('lifeCycles'), lifeCycles);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// return props;
|
||||
// }, TransformStage.Init);
|
||||
|
||||
// 设计器组件样式处理
|
||||
function stylePropsReducer(props: any, node: any) {
|
||||
if (props && typeof props === 'object' && props.__style__) {
|
||||
|
||||
@ -22,7 +22,6 @@ export default class PageEngine extends BaseEngine {
|
||||
static contextType = AppContext;
|
||||
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
// debugger;
|
||||
debug('page.getDerivedStateFromProps');
|
||||
const func = props.__schema.lifeCycles && props.__schema.lifeCycles.getDerivedStateFromProps;
|
||||
if (func) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user