Bootstrap 文件上傳插件 FileInput的使用問題

 

bootstrap

  在使用bootstrap的文件上傳插件fileinput http://plugins.krajee.com/file-input的預覽功能時,刪除預覽圖片在 bootstrap 模態框中沒有用,須要先點擊移除,在點刪除纔有用ide

  問題對比:url

       1.在正常頁面中可使用spa

  

 <input type="file" id="test" class="form-control inline-form-control"/>
$(document).ready(function () {
        var url1 = 'http://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/FullMoon2010.jpg/631px-FullMoon2010.jpg';


        $("#test").fileinput({
            initialPreview: [url1],
            initialPreviewAsData: true,
            initialPreviewConfig: [
                {caption: "Moon.jpg", downloadUrl: url1, size: 930321, width: "120px", key: 1}
            ],
            deleteUrl: "/watch/video/deleteimage",
            overwriteInitial: false,
            maxFileSize: 100,
            initialCaption: "The Moon and the Earth"
        });
     $("#test2").fileinput({ initialPreview: [url1], initialPreviewAsData: true, initialPreviewConfig: [ {caption: "Moon.jpg", downloadUrl: url1, size: 930321, width: "120px", key: 1} ], deleteUrl: "/watch/video/deleteimage", overwriteInitial: false, maxFileSize: 100, initialCaption: "The Moon and the Earth" });
});

    點擊刪除,看到了刪除請求插件

  

 

 

 

2.一樣的代碼,將 input 放到modal中3d

  modal代碼code

  

<div class="modal fade" id="editVideo" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
     aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">修改視頻評測</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body" style="min-height: 260px;">
                <div class="row" style="height: auto">
                   
                      <input type="file" class="form-control" name="editfile" id="test2">
                          
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
                <button type="submit" class="btn btn-primary edit-confirm">肯定</button>
            </div>
        </div>
    </div>
</div>

  js在上文已給出orm

  

相關文章
相關標籤/搜索