這里采用自定義縮略圖模版,定義排序按鈕。
頁(yè)面代碼
<el-upload action="#" :file-list="imageList" list-type="picture-card">
<i class="el-icon-plus avatar-uploader-icon"></i>
<div slot="file" slot-scope="{file}" style="width: 100%;height: 100%;">
<!-- <img class="el-upload-list__item-thumbnail" :src="file.url" alt=""> -->
<el-image v-if="file.status !== 'uploading'" style="width: 100px; height: 100px" :src="file.url" fit="contain"></el-image>
<label class="el-upload-list__item-status-label">
<i class="el-icon-upload-success el-icon-check"></i>
</label>
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-delete" @click="handleMove(file)">
<i class="el-icon-back"></i>
</span>
<span class="el-upload-list__item-delete" @click="handleRemove(file)">
<i class="el-icon-delete"></i>
</span>
</span>
<el-progress v-if="file.status === 'uploading'" type="circle" stroke-width="6"
:percentage="parseInt(file.percentage, 10)">
</el-progress>
</div>
</el-upload>
JS
點(diǎn)擊按鈕圖片向前移動(dòng)一格
handleMove(file) {
let idx;
this.images.forEach((image, index) => {
if (image.url == file.url) {
idx = index;
}
})
console.log(idx)
if (idx > 0) {
let tmp = this.imageList[idx - 1];
Vue.set(this.imageList, idx - 1, this.imageList[idx])
Vue.set(this.imageList, idx, tmp)
}
},
按圖片順序保存序號(hào)即可。
- 版權(quán)所有:奇站網(wǎng)絡(luò) 轉(zhuǎn)載請(qǐng)注明出處
- 廈門(mén)奇站網(wǎng)絡(luò)科技有限公司,專(zhuān)業(yè)提供網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站建設(shè),小程序開(kāi)發(fā),系統(tǒng)定制開(kāi)發(fā)。
- 軟件開(kāi)發(fā)咨詢(xún)熱線(xiàn):吳小姐 13313868605