Skip to content

Commit

Permalink
fix:修复api路径包含event变量报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Dec 6, 2023
1 parent 16d843f commit ad92bc1
Showing 1 changed file with 39 additions and 20 deletions.
59 changes: 39 additions & 20 deletions packages/amis-core/src/utils/renderer-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,50 @@ export function createRendererEvent<T extends RendererEventContext>(
type: string,
context: T
): RendererEvent<T> {
const rendererEvent = {
context: extendObject({pristineData: context.data}, context),
type,
prevented: false,
stoped: false,
preventDefault() {
rendererEvent.prevented = true;
},
const rendererEvent: RendererEvent<T> = Object.defineProperties(
{
context: extendObject({pristineData: context.data}, context),
type,
prevented: false,
stoped: false,
preventDefault() {
rendererEvent.prevented = true;
},

stopPropagation() {
rendererEvent.stoped = true;
},
stopPropagation() {
rendererEvent.stoped = true;
},

get data() {
return rendererEvent.context.data;
},
get data() {
return rendererEvent.context.data;
},

get pristineData() {
return rendererEvent.context.pristineData;
},
get pristineData() {
return rendererEvent.context.pristineData;
},

setData(data: any) {
rendererEvent.context.data = data;
setData(data: any) {
rendererEvent.context.data = data;
}
},
{
context: {
enumerable: false
},
pristineData: {
enumerable: false
},
preventDefault: {
enumerable: false
},
stopPropagation: {
enumerable: false
},
setData: {
enumerable: false
}
}
};
);
return rendererEvent;
}

Expand Down

0 comments on commit ad92bc1

Please sign in to comment.