Boostrap模态未在Laravel 5中加载

时间:2018-09-15 16:17:46

标签: laravel-5 modal-dialog bootstrap-4

我正在尝试在Laravel中加载Bootstrap模态,但根本没有出现。我已经安装了node_modules。在我的resources/assets/sass/app.scss中,默认情况下具有以下内容:

// Variables
@import "variables";

// Bootstrap
@import '~bootstrap/scss/bootstrap';

这是我的按钮:

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#edit-button" id="edit-button">Edit</button>

这是我的模态:

 <!-- Modal EDIT -->
     <div class="modal" id="edit-button" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Edit section</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        //model body
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary">Save</button>
                    </div>
                </div>
            </div>
     </div>

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

我终于找到了!在app.blade.php文件中,我需要包含app.js之类的

<script src="{{ asset('js/app.js') }}"></script>

默认情况下,尽管会加载仅包含

的Vue.js文件
require('./bootstrap');

app.js文件位于

resources/assets/js/app.js