如何将Fomantic-UI导入Angular项目中

问题描述 投票:0回答:1

我正在基于Fomantic-UI框架(这是Semantic-UI的分支)开发Angular项目。

我已经安装了它:

npm install --save fomantic-ui

然后我在angular.json文件中添加了以下几行:

"styles": [
    "node_modules/fomantic-ui/dist/semantic.min.css",
    "src/styles.scss"
],
"scripts": [
    "node_modules/jquery/dist/jquery.min.js",
    "node_modules/fomantic-ui/dist/semantic.min.js"
]

我已经用npm install --save @types/semantic-ui为其安装了类型,并且根据this,它们应该可以在Fomantic-UI上正常工作。

无论如何,这似乎不足以使用诸如modal()dropdown()calendar()之类的功能,实际上我在IDE(Webstorm)内和编译期间均出现错误:

TS2339:类型'JQuery'上不存在属性'modal'。

TS2339:类型'JQuery'上不存在属性'calendar'。

TS2339:类型'JQuery'上不存在属性'dropdown'。

依此类推...

您知道在我的项目中导入Fomantic-UI的正确方法是什么吗?

jquery angular semantic-ui fomantic-ui
1个回答
0
投票

`您可以尝试一下,

($(“ div.modal”))。modal();

接口JQuery {modal():void;`}

© www.soinside.com 2019 - 2024. All rights reserved.