禁用检查器 [英] Disable inspector

查看:53
本文介绍了禁用检查器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在一个简单的A-Frame WebVR应用程序上禁用检查器,但没有成功.

I'm trying to disable inspector on a simple A-Frame WebVR app with no success.

尝试使用JavaScript并禁用 Ctrl + Alt + I 的按键.但是,检查器仍在加载.

Tried to use and also disabling key press Ctrl + Alt + I using JavaScript. But, inspector is still loading.

有人知道怎么做吗?

我的场景很简单:

<html>

<head>
  <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
</head>

<body>
  <a-scene>
    <a-assets><img id="render" src="back.png"></a-assets>
    <a-sky src="#render"></a-sky>
  </a-scene>
</body>

</html>

推荐答案

您可以添加一个禁用检查器组件,该组件调用检查器的remove函数,然后在场景中使用该组件.

You can add a disable-inspector component that calls the remove function of the inspector, and then use this component on the scene.

AFRAME.registerComponent('disable-inspector', {
  dependencies: ['inspector'],
  init: function () {
    this.el.components.inspector.remove();
  }
});

并在您的html文件中:

and in your html file:

<a-scene disable-inspector>
  ...
</a-scene>

这篇关于禁用检查器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆