var myContainer: any = null;
<div id="container" ref={container => myContainer = container}>
<p id="child" > test</p>
</div>
现在我想知道 event.target 是否在 ref 内。
document.addEventListener("click", function (event) {
var target = event.target;
if(target is inside myContainer){
console.log("target is inside my container");
}
});
长风秋雁
相关分类