且构网

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

无法将A框架导入组件-Angular2

更新时间:2023-11-22 17:14:16

要使它在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"
  ]