【发布时间】:2018-06-21 07:08:36
【问题描述】:
我正在使用bootstrap-select
我已经成功地将bootstrap-select 导入到我的项目中,使用:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/css/bootstrap-select.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/bootstrap-select.min.js"></script>
<!-- (Optional) Latest compiled and minified JavaScript translation files -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/i18n/defaults-*.min.js"></script>
在文档<head> 标签内。我想看看如何修改多个选择框中的复选标记,并想我会尝试使用
$('.selectpicker').selectpicker('deselectAll');
方法如图here。每当我尝试使用那段代码时,都会收到错误消息:
TS2339: Property 'selectpicker' does not exist on type 'JQuery<HTMLElement>'.
我什至尝试使用安装类型定义
npm install --save-dev @types/bootstrap-select
但问题仍然存在。我正在使用 Visual Studio SPA 模板,它使用 ASP.NET Core 模板、Vue.js 和 Webpack。
【问题讨论】:
标签: jquery typescript webpack bootstrap-4 bootstrap-select