我们如何在 angular 中使用 Semantic-UI 类型文件

How can we use Semantic-UI typings file in angular

许多文章解释了如何在 Angular2/4 中为第三方库安装 typings, 1. npm install --save-dev jquery, 2. typing install dt~jquery 3..ts文件中import * as $ from 'jquery';

所以我需要有人来解释我们如何使用键入文件 typing install dt~semantic--save 在 Angular2/4 项目中安装 Semantic-UI 以便使用像 [=16= 这样的代码].当我尝试这样做时,它在控制台中抛出一个错误,

TypeError: __WEBPACK_IMPORTED_MODULE_5_jquery__(...).accordion is not a function at ...

手风琴坏了。

提前致谢。

哦,我成功地完成了这项工作,在安装 jquery typings file 之后,我通过 typing install dt~semantic --save 安装了 simantic-ui,并在文件之上:src/typings.d.ts 我添加了这一行:/// <reference path="../typings/index.d.ts"/> 就这样。

顺便说一句:.ts 文件中不需要 "declare var $: any;""import * as $ from 'jquery';"