我正在尝试创建一个角形+Fomantic操场,但我在将Fomantic导入到角度项目时遇到了问题。
这是我的StackBlitz:https://stackblitz.com/edit/angular-hcvmam
如您所见,我确实导入了jquery、fomantic-ui-css和它们的相关类型,并尝试使用Fomantic(弹出)的一种功能:
$('.bell.icon', this.el.nativeElement)['popup']({
popup: $('.ui.popup', this.el.nativeElement),
position: 'bottom right',
on: 'click'
});<i class="large blue bell icon"></i>
<div class="ui popup">
<div class="ui middle aligned divided list">
<div class="item" *ngFor="let alert of alerts" [@expandCollapse]>
<div class="content">
<div class="header">
{{alert.title}}
</div>
<div>
{{alert.desc}}
</div>
</div>
</div>
</div>
</div>但是它不起作用:.popup不是一个函数
其他F模块也是如此,如modal、transition、dropdown等.
你能找出让它起作用的是什么吗?如果你回答了,你也可以回答this。
发布于 2020-07-21 10:03:46
在stackblitz上使用fomantic和jquery库似乎存在问题。我不知道它们为什么不能工作,但是通过在index.html中添加CDN链接并使用
declare var $: JQueryStatic;而不是
import $ from 'jquery';您可以在代码中使用fomantic添加的jquery。
https://stackblitz.com/edit/angular-rjet1p
在运行代码时,我在代码中出现了一些错误,但它们超出了这个问题的范围。
https://stackoverflow.com/questions/63011847
复制相似问题