简体   繁体   English

Bootstrap,popper.js和vue.js

[英]Bootstrap, popper.js and vue.js

In my laravel application, I have page that are rendered with vue.js. 在我的laravel应用程序中,我有用vue.js呈现的页面。 I want to add some popup in this page and use popper.js. 我想在此页面中添加一些弹出窗口并使用popper.js。 Following the documentation, this lib is included in bootstrap.bundle.min.js. 根据文档,此库包含在bootstrap.bundle.min.js中。

I have this in my html page: 我的html页面中有这个:

<script src="https://code.jquery.com/jquery-3.3.1.min.js"crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js"></script>

And I have this method in my Vue component: 我的Vue组件中有以下方法:

        showCalendarChoiceHelpPopover() {
            console.log("click");
            $('#calendar').popover({
                trigger: 'focus',
                title: 'title',
                content: 'content'
            });
        }

When I load my page I have the following error message: 加载页面时,出现以下错误消息:

TypeError: __WEBPACK_IMPORTED_MODULE_5_jquery___default(...)(...).popover is not a function

Okay mate so if you use Bootstrap 4 you need to include Popper.js 好的朋友,如果您使用Bootstrap 4,则需要包含Popper.js

https://getbootstrap.com/docs/4.0/getting-started/introduction/#js https://getbootstrap.com/docs/4.0/getting-started/introduction/#js

Many of our components require the use of JavaScript to function. 我们的许多组件都需要使用JavaScript才能起作用。 Specifically, they require jQuery, Popper.js, and our own JavaScript plugins. 具体来说,它们需要jQuery,Popper.js和我们自己的JavaScript插件。

And remember jQuery first, then Popper.js, then Bootstrap JS 并先记住jQuery,然后记住Popper.js,然后记住Bootstrap JS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM