mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-15 09:21:13 +08:00
amis-saas-8252 [Bug] 开关组件配置表达式无效
Change-Id: Ieae60b9ea3a82a9b60b0dbe0eaa1efd48bf70ef6
This commit is contained in:
parent
c8ca2d65e8
commit
a79bfade83
@ -184,14 +184,21 @@ export class SwitchControlPlugin extends BasePlugin {
|
||||
rendererSchema: context?.schema,
|
||||
needDeleteProps: ['option'],
|
||||
rendererWrapper: true, // 浅色线框包裹一下,增加边界感
|
||||
valueType: 'boolean',
|
||||
// valueType: 'boolean',
|
||||
pipeIn: (value: any, data: any) => {
|
||||
const {trueValue = true} = data.data || {};
|
||||
return value === trueValue ? true : false;
|
||||
const {trueValue = true, falseValue = false} =
|
||||
data.data || {};
|
||||
return value === trueValue
|
||||
? true
|
||||
: value === falseValue
|
||||
? false
|
||||
: value;
|
||||
},
|
||||
pipeOut: (value: any, origin: any, data: any) => {
|
||||
return value
|
||||
return value && value === (data.trueValue || true)
|
||||
? data.trueValue || true
|
||||
: value && value !== (data.falseValue || false)
|
||||
? value
|
||||
: data.falseValue || false;
|
||||
}
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user