mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:48:13 +08:00
fix: 按钮disabledOn属性失效问题 (#4324)
This commit is contained in:
parent
0f55b7cc8b
commit
a9004e2563
@ -45,6 +45,63 @@ CRUD,即增删改查组件,主要用来展现数据列表,并支持各类
|
||||
{
|
||||
"name": "grade",
|
||||
"label": "CSS grade"
|
||||
},
|
||||
{
|
||||
"type": "operation",
|
||||
"label": "操作",
|
||||
"buttons": [
|
||||
{
|
||||
"label": "详情",
|
||||
"type": "button",
|
||||
"level": "link",
|
||||
"actionType": "dialog",
|
||||
"dialog": {
|
||||
"title": "查看详情",
|
||||
"body": {
|
||||
"type": "form",
|
||||
"body": [
|
||||
{
|
||||
"type": "input-text",
|
||||
"name": "engine",
|
||||
"label": "Engine"
|
||||
},
|
||||
{
|
||||
"type": "input-text",
|
||||
"name": "browser",
|
||||
"label": "Browser"
|
||||
},
|
||||
{
|
||||
"type": "input-text",
|
||||
"name": "platform",
|
||||
"label": "platform"
|
||||
},
|
||||
{
|
||||
"type": "input-text",
|
||||
"name": "version",
|
||||
"label": "version"
|
||||
},
|
||||
{
|
||||
"type": "control",
|
||||
"label": "grade",
|
||||
"body": {
|
||||
"type": "tag",
|
||||
"label": "${grade}",
|
||||
"displayMode": "normal",
|
||||
"color": "active"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "删除",
|
||||
"type": "button",
|
||||
"level": "link",
|
||||
"className": "text-danger",
|
||||
"disabledOn": "this.grade === 'A'"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -391,10 +391,14 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
||||
ref: this.refFn,
|
||||
render: this.renderChild,
|
||||
rootStore: rootStore,
|
||||
disabled: disable ?? rest.disabled ?? restSchema.disabled,
|
||||
// disabled: disable ?? rest.disabled ?? restSchema.disabled,
|
||||
dispatchEvent: this.dispatchEvent
|
||||
};
|
||||
|
||||
if (disable) {
|
||||
(props as any).disabled = true;
|
||||
}
|
||||
|
||||
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
|
||||
if (renderer.autoVar) {
|
||||
for (const key of Object.keys($schema)) {
|
||||
|
Loading…
Reference in New Issue
Block a user