91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

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

本溪市| 宁陕县| 马尔康县| 高陵县| 华安县| 光山县| 伊宁市| 葫芦岛市| 任丘市| 天镇县| 娄烦县| 洛扎县| 石阡县| 安溪县| 关岭| 漯河市| 蛟河市| 吴堡县| 榆树市| 阿勒泰市| 夏津县| 福海县| 金山区| 黎川县| 新龙县| 礼泉县| 广平县| 永兴县| 曲靖市| 华蓥市| 安宁市| 仙桃市| 思南县| 沙洋县| 淮南市| 建昌县| 大同市| 广州市| 榆树市| 广汉市| 成武县|