fix: when the component is configured in a loop, the key value changes and renders error

This commit is contained in:
liujuping 2023-03-03 17:08:04 +08:00 committed by 林熠
parent 29b91846fb
commit 5db418efe4
4 changed files with 19 additions and 4 deletions

View File

@ -774,6 +774,11 @@ export default function baseRendererFactory(): IBaseRenderComponent {
{ {
...schema, ...schema,
loop: undefined, loop: undefined,
props: {
...schema.props,
// 循环下 key 不能为常量,这样会造成 key 值重复,渲染异常
key: isJSExpression(schema.props?.key) ? schema.props?.key : null,
},
}, },
loopSelf, loopSelf,
parentInfo, parentInfo,

View File

@ -13,6 +13,11 @@ export interface IPluginPreferenceMananger {
export type PluginOptionsType = string | number | boolean | object; export type PluginOptionsType = string | number | boolean | object;
export interface IPublicApiPlugins { export interface IPublicApiPlugins {
/**
* plugin api export
*/
[key: string]: any;
register( register(
pluginModel: IPublicTypePlugin, pluginModel: IPublicTypePlugin,
options?: Record<string, PluginOptionsType>, options?: Record<string, PluginOptionsType>,
@ -21,6 +26,7 @@ export interface IPublicApiPlugins {
/** /**
* *
*
* use this to get preference config for this plugin when engine.init() called * use this to get preference config for this plugin when engine.init() called
*/ */
getPluginPreference( getPluginPreference(
@ -29,24 +35,28 @@ export interface IPublicApiPlugins {
/** /**
* *
*
* get plugin instance by name * get plugin instance by name
*/ */
get(pluginName: string): IPublicModelPluginInstance | null; get(pluginName: string): IPublicModelPluginInstance | null;
/** /**
* *
*
* get all plugin instances * get all plugin instances
*/ */
getAll(): IPublicModelPluginInstance[]; getAll(): IPublicModelPluginInstance[];
/** /**
* *
*
* check if plugin with certain name exists * check if plugin with certain name exists
*/ */
has(pluginName: string): boolean; has(pluginName: string): boolean;
/** /**
* *
*
* delete plugin instance by name * delete plugin instance by name
*/ */
delete(pluginName: string): void; delete(pluginName: string): void;

View File

@ -1,3 +1,3 @@
import { IPublicTypeCompositeObject } from './'; import { IPublicTypeCompositeObject, IPublicTypeNodeData } from './';
export type IPublicTypePropsMap = IPublicTypeCompositeObject; export type IPublicTypePropsMap = IPublicTypeCompositeObject<IPublicTypeNodeData | IPublicTypeNodeData[]>;

View File

@ -131,6 +131,6 @@ export interface IPublicTypeJSONObject {
} }
export type IPublicTypeCompositeArray = IPublicTypeCompositeValue[]; export type IPublicTypeCompositeArray = IPublicTypeCompositeValue[];
export interface IPublicTypeCompositeObject { export interface IPublicTypeCompositeObject<T = IPublicTypeCompositeValue> {
[key: string]: IPublicTypeCompositeValue; [key: string]: IPublicTypeCompositeValue | T;
} }