我正在使用primeng和Bootstrap 4作为Angular2应用程序。虽然primeng工具提示组件运行良好,但调试控制台始终显示此日志:
Uncaught ReferenceError: Tooltip is not defined
at Popover (eval at module.exports (addScript.js:9), <anonymous>:3524:32)
at eval (eval at module.exports (addScript.js:9), <anonymous>:3677:3)
at eval (<anonymous>)
at module.exports (addScript.js:9)
at Object.541 (bootstrap.js?41b4:1)
at __webpack_require__ (bootstrap a7ab881…:52)
at Object.1272 (scripts.bundle.js:8)
at __webpack_require__ (bootstrap a7ab881…:52)
at webpackJsonpCallback (bootstrap a7ab881…:23)
at scripts.bundle.js:1
我试图注释出primeng部分,但错误仍然存在。 有没有人见过这个?
我的angular-cli.json部分:
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.css",
"../node_modules/primeng/resources/primeng.min.css",
"../node_modules/primeng/resources/themes/bootstrap/theme.css",
"styles.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],
我使用工具提示的唯一地方如下
import { TooltipModule } from 'primeng/primeng';
<a class="list-item-lockup"
routerLink="{{item.path}}"
[pTooltip]="isSideBarCollapsed ? item.data.title : null">
<i class="fa {{item.data.icon}} fa-fw" aria-hidden="true"></i>
<span [class.list-span-collapsed]="isSideBarCollapsed">{{item.data.title}}</span>
</a>
问题来自bootstrap.js`,删除“../node_modules/bootstrap/dist/js/bootstrap.js”后,应该没有错误。 为什么会这样?