javascript - 即使使用 div 覆盖也无法在 iframe 上注册点击
问题描述
我在我的网站上嵌入了一个 iframe,如下所示:
HTML
<div style="position: relative; background-color: #8c9099; height: 300px; z-index: 2"
(click)="setSelectedCourseElementFiddleUid()">
<iframe width="100%" height="300px"
style="z-index: 1; position: absolute; top: 0; left: 0; height: 300px; display: inline-block"
src="//jsfiddle.net/tutorpass/wLrk94mp/embedded/html,css,result/?accentColor=335eea"
allowfullscreen="allowfullscreen" allowpaymentrequest [attr.frameborder]="0"></iframe>
</div>
JavaScript
import { Component, VERSION } from "@angular/core";
@Component({
selector: "my-app",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent {
name = "Angular " + VERSION.major;
setSelectedCourseElementFiddleUid() {
console.log("hello");
}
}
但是“点击”本身似乎没有注册,即使是 div 覆盖。关于如何解决这个问题的任何想法?
我在这里上传了一个 Stackblitz:https ://stackblitz.com/edit/angular-ivy-jupmvt 。
解决方案
推荐阅读
- conan - 为什么我的柯南包似乎损坏了?
- r - 使用 map 和 pluck 从嵌套列表中获取值
- autodesk-forge - 有没有办法使用 API 从 BIM360 Docs“项目文件”目录中导出带有标记的 PDF 文件?
- github - 为 Gitlab 构建服务
- c++ - 通过移动链表中的节点进行冒泡排序(C++)
- amazon-web-services - AWS Route 53 托管区域中多个子域的最佳实践
- java - 无法执行 javac 和 jps
- debugging - 关于 GAS,我无法使用 Logger.log() 观看消息日志
- python - 按顺序遍历查询集和具有相似键的字典
- django - django-keycloak | 将用户名设置为 Keycloak 用户名(而不是 Keycloak ID)