mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 修复修改 readonly 属性时报错
This commit is contained in:
parent
9afa0771d1
commit
93f5c3b7b1
@ -159,7 +159,7 @@ class Renderer extends Component<{
|
||||
suspended={renderer.suspended}
|
||||
self={renderer.scope}
|
||||
customCreateElement={(Component: any, props: any, children: any) => {
|
||||
const { __id, __desingMode, ...viewProps } = props;
|
||||
const { __id, __designMode, ...viewProps } = props;
|
||||
viewProps.componentId = __id;
|
||||
const leaf = documentInstance.getNode(__id) as Node;
|
||||
if (isFromVC(leaf?.componentMeta)) {
|
||||
|
||||
@ -47,6 +47,11 @@ function haveForceUpdate(instances: any[]): boolean {
|
||||
return instances.every(inst => 'forceUpdate' in inst);
|
||||
}
|
||||
|
||||
function isPropWritable(props: any, propName: string): boolean {
|
||||
const descriptor = Object.getOwnPropertyDescriptor(props, propName);
|
||||
return !!descriptor?.writable;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持快捷属性值设值
|
||||
* @param data
|
||||
@ -69,6 +74,8 @@ export function supportsQuickPropSetting(data: ActivityData, doc: DocumentInstan
|
||||
propKey &&
|
||||
// 不是 extraProp
|
||||
!propKey.startsWith('___') &&
|
||||
// props[propKey] 有可能是 readyonly 的
|
||||
instances.every(inst => isPropWritable(inst.props, propKey)) &&
|
||||
!isJSSlot(value) &&
|
||||
// functional component 不支持 ref.props 直接设值,是 readonly 的
|
||||
isReactClass((doc.container?.components as any)[componentName]) &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user