Replies: 2 comments 3 replies
-
|
lowcode-engine 复现步骤:
{
"componentName": "Page",
"id": "node_dockcviv8fo1",
"props": {
"ref": "outerView",
"style": {
"height": "100%"
}
},
"fileName": "/",
"dataSource": {
"list": [
{
"type": "fetch",
"isInit": true,
"options": {
"params": {},
"method": "GET",
"isCors": true,
"timeout": 5000,
"headers": {},
"uri": "mock/info.json"
},
"id": "info"
}
]
},
"state": {
"list": {
"type": "JSExpression",
"value": "[{\n label: '1',\n value: '1'\n}]"
}
},
"css": "body {\n font-size: 12px;\n}\n\n.button {\n width: 100px;\n color: #ff00ff\n}",
"lifeCycles": {
"componentDidMount": {
"type": "JSFunction",
"value": "function componentDidMount() {\n console.log('did mount');\n setTimeout(() => {\n this.setState({\n list: [{\n label: '1',\n value: '1'\n }, {\n label: '2',\n value: '2'\n }]\n }, () => {\n console.log('更新 state.list 成功', this.state);\n });\n }, 2000);\n}"
}
},
"methods": {},
"originCode": "class LowcodeComponent extends Component {\n state = {\n list: [\n { label: '1', value: '1' }\n ]\n }\n\n componentDidMount() {\n console.log('did mount');\n setTimeout(() => {\n this.setState({\n list: [\n { label: '1', value: '1' },\n { label: '2', value: '2' }\n ]\n }, () => {\n console.log('更新 state.list 成功', this.state)\n })\n }, 2000)\n }\n}",
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FormilyForm",
"id": "node_ocl56ddwtf1",
"props": {
"componentProps": {
"layout": "vertical"
},
"__component_name": "FormilyForm",
"ref": "formily_eie71x25h1"
},
"title": "FormilyForm",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FormilySelect",
"id": "node_ocl56ddwtf5",
"props": {
"__component_name": "FormilySelect",
"fieldProps": {
"name": "habit",
"title": "Select",
"x-validator": [],
"enum": "{{$this.state.list}}"
},
"componentProps": {
"x-component-props": {}
},
"decoratorProps": {
"x-decorator-props": {}
}
},
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
试试createForm({designable:true}) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment




Uh oh!
There was an error while loading. Please reload this page.
-
Reproduction link
Steps to reproduce
伪代码结构如下:
enum: {{ $page.state.list }}this.setState({ list: [{label: 1, value: 1}, { label: 2, value: 2 }]})尝试通过 clearFormGraph 去解决
但这种方式会导致 field 重新实例化,又重新 mount 了,如果 field 实例 mount 的时候,有调用 $page.setState 场景的话,会触发无限循环(在线源码链接可复现)
What is expected?
What is actually happening?
现在出现的情况是:
Package
@formily/core@2.1.9
在线链接: https://codesandbox.io/s/proud-wood-j71knz?file=/App.tsx
Beta Was this translation helpful? Give feedback.
All reactions