【发布时间】:2021-08-10 12:53:26
【问题描述】:
在我的 Angular-11 中,我有这个 Javascript 文件:
"node_modules/admin-lte/plugins/bs-stepper/js/bs-stepper.min.js",
如上所示,我将它添加到 angular.json 中。
import Stepper from '...';
@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.css']
})
export class ProfileComponent implements OnInit {
name = 'Angular';
private stepper: Stepper;
next() {
this.stepper.next();
}
onSubmit() {
return false;
}
ngOnInit() {
this.stepper = new Stepper(document.querySelector('#stepper1'), {
linear: false,
animation: true
})
}
}
如何将其导入到这个组件中:profile.component.ts 这种方式,
从'...'导入步进器;
来自 Javascript 路径
谢谢
【问题讨论】:
-
你试过
import Stepper from 'bs-stepper';吗? -
@RomanA - 当我从 'bs-stepper' 导入 Stepper 时;它不认识 Stepper。所以,我使用的是 AdminLTE3,它有自己的助手
-
import * as Stepper from 'node_modules/admin-lte/plugins/bs-stepper/js/bs-stepper.min.js;'或从 'node_modules/admin-lte/plugins/bs-stepper/js/bs-stepper.min.js;' 导入 Stepper你试过这个吗?
-
@RomanA。 - 我收到此错误:ot using the local TSLint version found for 'c:/xampp/htdocs/myapp/src/app/auth/profile/profile.component.ts' 要从当前工作区启用代码执行,您必须启用工作区库执行.tslint(1)
-
请检查这个以获取您的最新一期stackoverflow.com/questions/65228384/…
标签: javascript angular