【问题标题】:How do I import the bootstrap.min.js into Vue JS如何将 bootstrap.min.js 导入 Vue JS
【发布时间】:2020-04-11 06:41:12
【问题描述】:

我的 Vue JS 应用 Bootstrap 导航栏无法在移动设备上运行。我已经安装了 Bootstrap、JQuery 和 popper 节点模块。我的 Vue JS 应用程序显示错误 Module Not Found。无法解析“node_modules/bootstrap/dist/js/bootstrap”

这是我在 App.vue 上的代码

<style lang="scss">
$primary: #05b2dd;
@import "node_modules/bootstrap/scss/bootstrap";
</style>

<script>
import "node_modules/jquery/dist/jquery.slim.min";
import "node_modules/popper/dist/popper.min";
import "node_modules/bootstrap/dist/js/bootstrap.min";
</script>

我的 Vue 应用程序中的文件路径存在:node_modules\bootstrap\dist\js\bootstrap.min.js

【问题讨论】:

    标签: vue.js


    【解决方案1】:

    我已将 JS 文件的导入移至 main.js。这是代码sn-p

    import "../node_modules/jquery/dist/jquery.slim.min";
    import "../node_modules/popper.js/dist/popper.min";
    import "../node_modules/bootstrap/dist/js/bootstrap";
    

    导航现在可以在移动设备上使用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-17
      • 2020-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-06
      • 1970-01-01
      • 2017-05-08
      相关资源
      最近更新 更多