加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

使用角度为2的无类型的A框架组件

发布时间:2020-12-17 09:15:56 所属栏目:安全 来源:网络整理
导读:有没有办法在没有打字的Angular-CLI上运行库? 在我的情况下,我试图安装k-frame来使用aframe-template-component和通过documentation,我明白我必须创建一个typings.d.ts文件,使用它与TypeScript.根据this的问题,我已经尝试了不同的选项,但是我无法生成文件或
有没有办法在没有打字的Angular-CLI上运行库?

在我的情况下,我试图安装k-frame来使用aframe-template-component和通过documentation,我明白我必须创建一个typings.d.ts文件,使用它与TypeScript.根据this的问题,我已经尝试了不同的选项,但是我无法生成文件或直接导入到项目中.

我也试过运行和安装dts-gen,但是我收到以下错误:

Component attempted to register before AFRAME was available

这意味着我必须首先注册A帧.自从一段时间以来我陷入困境,你有没有想到如何解决以下问题?提前感谢您的回复!

目前这是一件不容易的工作.

我尝试用AngularCli.我已经创建了一个新项目,使用新的,我已经按照以下步骤:

>新的kframetest
>安装aframe和aframe-template-components使用:

npm install aframe aframe-template-component --save

>由于两个(zone.js和A-frame)捕获attributeChangedCallback,你需要在zone.js.之前加载A帧.然后(在polyfills.ts文件中)我已经添加:

import 'aframe';
import 'aframe-template-component';

在进口’zone.js / dist / zone’之前;
>使用kframe sample作为模板创建一个简单的组件.
>为了Angular可以解析特殊html标签,如< a-entity>您必须使用schemas属性将一个CUSTOM_ELEMENTS_SCHEMA和NO_ERRORS_SCHEMA添加到NgModule中:

schemas: [CUSTOM_ELEMENTS_SCHEMA,NO_ERRORS_SCHEMA]

>运行应用程序.

现在您可以在控制台中看到A框运行:

Put the A-Frame script tag in the head of the HTML before the scene to ensure everything for A-Frame is properly registered before they are used from HTML.

06003

但是最大的问题是Angular tryes来解析HTML,他不明白aframe模板的语法,你会得到这个错误:

Unhandled Promise rejection: Template parse errors:
Parser Error: Unexpected token # at column 6 in [src: #boxesTemplate] in KFrameTestComponent

06004

Property binding src not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the @NgModule.declarations.

06005

我一直在搜索添加html没有角度解析它,但我没有找到…

我已经尝试将模板添加到索引html,它似乎工作,但我明白,这不是你想要的情况.

你可以从这里得到代码:https://gitlab.com/jros/angularcli-kframe

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读