已经尝试的方法
- 添加参数
http://localhost:4200/user/userDetails?userId=xx&time=xxxx - 发生变化之后,先将iframeUrl = null,之后为iframeUrl重新复制
问题都没有解决
@ViewChild("targetIframe", {static: true}) targetIframe?: HTMLIFrameElement;
change(userId: string) {
this.iframeSrc1 = null;
const time = new Date().getTime();
this.iframeSrc1 = `http://localhost:4200/user/userDetails?userId=${userId}&time=${time}`
this.targetIframe?.contentWindow?.location.reload();
}
contentWindow获取不到该怎么处理?