1

我尝试在模态(Clarity-UI)内初始化 Dropzone,但我无法初始化。

CodePen 演示

注意:我使用以下代码手动运行模态:

   $('.js-upload-file-btn').on('click',function () {
        $(".js-upload-file, .modal-backdrop").addClass("open");
    });

    // close all modal
    $(document).on('click','.modal .close',function () {
        $(".modal, .modal-backdrop").removeClass("open");

    });
4

1 回答 1

3

只需将您的 html 代码更改为此代码即可:

 <!-- Modal Backdrop for all -->
<div class="modal-backdrop" aria-hidden="true"></div>

<!--Modal Create Folder -->
<div class="modal js-upload-file">
    <div class="modal-dialog" role="dialog" aria-hidden="true">
        <div class="modal-content">
           <!--<form action="">     // it should remove--> 
            <div class="modal-header">
                <a aria-label="Close" class="close">
                    <clr-icon aria-hidden="true" shape="close"></clr-icon>
                </a>
                <h3 class="modal-title">Upload</h3>
            </div>
            <div class="modal-body">

                <form id="dropzone" action="/" class="dropzone" method="post" enctype="multipart/form-data">
                    <div class="fallback">
                        <input name="file" type="file" multiple />
                    </div>
                </form>

            </div>
            <div class="modal-footer">
                <button class="btn btn-success" type="button">Save</button>
            </div>
           <!--</form> // it should remove-->
        </div>
    </div>
</div>

注意:可能需要进行自定义更改才能使其正常工作。您已使用两个<form>标签作为嵌套

于 2018-04-09T07:07:52.753 回答