【发布时间】:2018-06-26 19:16:08
【问题描述】:
当我尝试附加工具提示时,控制台中记录了以下错误。
Uncaught TypeError: Uncaught TypeError: $(...).tooltip 不是函数
我的编译器通过智能感知向我显示了所有工具提示选项,因此它似乎是通过类型定义文件获取引导模块。
import * as $ from "jquery";
import * as bootstrap from "bootstrap";
$(function () {
// jquery works
$("#btnOnboardingFilesUpload")
.click(function () { alert('upload files'); })
.attr('disabled', 'disabled')
.attr('title', 'You haven\'t selected any files.')
.attr('data-placement', 'top');
// bootstrap doesn't? Uncaught TypeError: Uncaught TypeError: $(...).tooltip is not a function
$("#btnOnboardingFilesUpload").tooltip();
});
当我尝试通过console.log(bootstrap); 记录引导程序时,对象为空:
{}
知道为什么不加载引导程序吗?
我在 package.json 中有以下依赖项:
"dependencies": {
"ts-loader": "^3.2.0",
"jquery": "^2.2.0",
"bootstrap": "^3.3.5"
},
【问题讨论】:
-
我无法理解为什么这个问题被否决了。有人能解释一下这个问题吗?
标签: javascript jquery twitter-bootstrap typescript typescript-typings