中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Vuejs jasnyBoostrap 上載 多張圖片的預覽效果

發布時間:2020-07-31 03:08:07 來源:網絡 閱讀:1902 作者:whaoran4726 欄目:開發技術

原版 jasnybootstrap無法進行多張圖片上傳后的預覽,所以借鑒了一些別的方法。


HTML

<v-form class="manage-file" id="manage-file" ref="form">

            <input type="hidden" name="pubprojectid" :value="project.id"></input>

            <div class="form-group">

                <label class="col-xs-3 control-label">項目圖片</label>

                <div class="col-xs-8">

                    <div class="fileinput fileinput-new" data-provides="fileinput">

                        <div>

                            <span class="btn btn-default btn-file">

                            <span class="fileinput-new">選擇文件</span>

                            <span class="fileinput-exists">修改文件</span>

                            <input type="file" multiple name="files" @change="filesChange">

                            </span>

                            <a @click="delFiles" class="btn btn-default fileinput-exists" data-dismiss="fileinput">刪除文件</a>

                        </div>

                    </div>

                    <div class="col-xs-12 padding-0">

                        <div class="fileinput" data-provides="fileinput" v-for="(fileItem, index) in files" style="margin-right: 5px; width: 150px;">

                            <div class="fileinput-new thumbnail" style="width: 150px;">

                                <div class="file" style="width: 100%; margin-bottom: 0;">

                                    <a>

                                    <span class="corner"></span>

                                    <div>

                                        <img :src="picSrc[index]" style="height:120px"></img>

                                    </div>

                                    </a>

                                </div>

                            </div>

                        </div>

                    </div>

                </div>

            </div>

        </v-form>


Vue代碼:

//files 和 imgsrc分開,就可以了

            for (let i = 0; i < e.target.files.length; i++) {

                let picture = e.target.files[i];

                if (picture) {

                    var reader = new FileReader();

                    reader.readAsDataURL(picture);

                    reader.onload = e =>{

                        this.picSrc.push(e.target.result);

                    };

                } else {

                    swal({

                    title: '請選擇上傳圖片',

                    confirmButtonText: '確定',

                    confirmButtonColor: '#294988',

                    type: 'error',

                    });

                }

                picture.uploadDate = new Date();

                this.files.push({pic: picture});

            }


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

巨鹿县| 台北市| 嘉荫县| 滨海县| 西充县| 宜良县| 渭南市| 嘉峪关市| 黄陵县| 察雅县| 蒙自县| 海口市| 平度市| 大同市| 高雄市| 宜宾县| 辽阳县| 安龙县| 昌都县| 临汾市| 北海市| 府谷县| 阿鲁科尔沁旗| 西乡县| 锡林郭勒盟| 江北区| 田林县| 承德县| 涿鹿县| 无锡市| 利辛县| 诸城市| 遵义县| 通渭县| 和田市| 江华| 鸡泽县| 伊通| 韶关市| 定南县| 磴口县|