Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue项目引入组件后,我想禁止右击,但是又想开放F12,这个该如何配置,我尝试过几次,只要引入组件后,F12就一定被禁用了 #93

Open
xuebear opened this issue May 17, 2024 · 4 comments

Comments

@xuebear
Copy link

xuebear commented May 17, 2024

vue项目引入组件后,我想禁止右击,但是又想开放F12,这个该如何配置,我尝试过几次,只要引入组件后,F12就一定被禁用了

@ixqbar
Copy link

ixqbar commented May 20, 2024

可以参数控制是否允许打开控制台

@qwIvan
Copy link

qwIvan commented Jun 6, 2024

我希望打开后触发事件,但不想禁止打开。怎么搞。

@theajack theajack added the enhancement New feature or request label Jun 9, 2024
@theajack
Copy link
Owner

theajack commented Jun 9, 2024

@qwIvan 这个是独立的行为,你额外加监听就可以

window.addEventListener('keydown', (e) => {
  const keyCode = e.keyCode || e.which;
  if ( keyCode === 123 ) {
    alert('xxxxxx');
  }
});

亲测有效

@theajack theajack removed the enhancement New feature or request label Jun 9, 2024
@kisekiremi
Copy link

vue项目引入组件后,我想禁止右击,但是又想开放F12,这个该如何配置,我尝试过几次,只要引入组件后,F12就一定被禁用了

vue3里用import.meta.env里判断开发环境,vue2的忘了XD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants