简体   繁体   English

如何禁用反应引导卡的右键单击?

[英]How to disable right click for a react bootstrap card?

请先看图

If i right click mouse, this option menu pops up.如果我右击鼠标,会弹出这个选项菜单。 But i want nothing should come.但我希望什么都不应该来。 How can i do that?我怎样才能做到这一点?

My Code:我的代码:

 <div>
    <Link to={{
        pathname: "/announcement",
        state: {courseId: this.state.selectedCourseId}
    }}
        className="link">
        <Card className="primaryCardDesign">
            <Card.Header className="primaryCardHeader">
                <Card.Title>
                    Announcement
                </Card.Title>
            </Card.Header>
            <Card.Body className="primaryCardBody">
                A declaration you want to share among the class
            </Card.Body>
        </Card>
    </Link>
</div>

Add onContextMenu event with an empty handler that prevents the opening of the context menu:添加带有空处理程序的onContextMenu事件,以防止打开上下文菜单:

 <Card className="primaryCardDesign" onContextMenu={e=>e.preventDefault();}>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM