我尝试将script.js添加到angular.json中,并在一个组件中使用它,这样对那些可以建议将脚本标记添加到我的html文件的人来说是行不通的,这不是一个好主意,所以请有人提出另一个想法,或者让我的脚本工作所遗漏的内容。谢谢
这是我的剧本:
$('.owl-carousel').owlCarousel({
loop:true,
margin:10,
dots:false,
nav:true,
mouseDrag:false,
autoplay:true,
animateOut: 'slideOutUp',
responsive:{
0:{
items:1
},
600:{
items:1
},
1000:{
items:1
}
}
});file.html:
<header>
<div class="owl-carousel owl-theme">
<div class="item">
<img src="https://cdn.pixabay.com/photo/2017/10/24/10/30/business-2884023_960_720.jpg" alt="images not found">
<div class="cover">
<div class="container">
<div class="header-content">
<div class="line"></div>
<h2>Teimagine Digital Experience with</h2>
<h1>Start-ups and solutions</h1>
<h4>We help entrepreneurs, start-ups and enterprises shape their ideas into products</h4>
</div>
</div>
</div>
</div>
<div class="item">
<img src="https://cdn.pixabay.com/photo/2016/03/09/09/22/workplace-1245776_960_720.jpg" alt="images not found">
<div class="cover">
<div class="container">
<div class="header-content">
<div class="line animated bounceInLeft"></div>
<h2>Reimagine Digital Experience with</h2>
<h1>Intelligent solutions</h1>
<h4>We help entrepreneurs, start-ups and enterprises shape their ideas into products</h4>
</div>
</div>
</div>
</div>
</header>发布于 2020-08-07 14:46:33
方法1:
“脚本”:“./path”;
然后添加typings.d.ts (如果不存在,则在src中创建此文件)
声明var variableName:any;
在您的文件中导入它作为
从'variableName';导入*作为变量
参考https://stackoverflow.com/a/44817445/9640128
方法2:
时添加多个脚本
https://stackoverflow.com/questions/63303759
复制相似问题