首页 > 解决方案 > FullCalendar 中的 eventContent 添加的按钮上的函数调用

问题描述

日历

日历

我正在 Angular 中集成完整的日历。我在完整的日历中添加了不同的事件。在每个事件中,我都在事件中添加了按钮。无论我在哪里点击事件,都会调用完整日历的事件点击。当用户单击事件内容内的按钮时,我想调用一个函数。有人可以帮助我我该怎么做。

下面是我在完整日历事件中的按钮代码。

标签: javascriptangulartypescriptfullcalendarfullcalendar-5

解决方案


如果我真的明白你的要求,那么 ans 是

event.stopPropagation();

片段示例

function parent(event) {

console.log(alert("parent"))
}

function child(event) {

event.stopPropagation();

console.log(alert("child"))
}
.parent{
  width: 200px;
 height: 200px;
 background-color: red;
 margin :auto ;


}
.child {
  width:100px;
  height:100px;
  margin:auto;
  background-color: blue;
}
<div class = "parent" onclick = "parent(event)" >
<div class = "child" onclick = "child(event)">
 child
</div>

</div>


推荐阅读