视频播放页面屏蔽右键菜单

This commit is contained in:
禺狨 2023-05-30 10:00:43 +08:00
parent 29630ec1ee
commit 537cac224a

View File

@ -32,6 +32,13 @@ const CoursePalyPage = () => {
e = e || window.event; e = e || window.event;
return false; return false;
}; };
return () => {
document.oncontextmenu = function (e) {
/*恢复浏览器默认右键事件*/
e = e || window.event;
return true;
};
};
}, [params.courseId, params.hourId]); }, [params.courseId, params.hourId]);
useEffect(() => { useEffect(() => {
@ -170,6 +177,11 @@ const CoursePalyPage = () => {
className={styles["close-btn"]} className={styles["close-btn"]}
onClick={() => { onClick={() => {
window.player && window.player.destroy(); window.player && window.player.destroy();
document.oncontextmenu = function (e) {
/*恢复浏览器默认右键事件*/
e = e || window.event;
return true;
};
navigate(-1); navigate(-1);
}} }}
> >