且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法将 A-frame 导入组件 - Angular2

更新时间:2023-11-22 17:23:34

要使其在 Angular2 中正常工作,您必须具备以下条件:

Here is what you have to get it properly working in Angular2:

  1. 编辑您的 angular-cli.json 并将路径添加到脚本节点:

"scripts": [
  "node_modules/aframe/dist/aframe-master.js"
],

  1. https 下载类型://github.com/devpaul/aframe-typings/blob/master/src/AFRAME.d.ts.

通过以下方式引用组件中的类型:

Reference the typings in your component with:

/// <reference path="../typings/AFRAME.d.ts" />

或在您的 tsconfig.json 中全局安装类型:

or install the typings globally in your tsconfig.json:

"files": [
    "typings/AFRAME.d.ts"
  ]