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