File tree Expand file tree Collapse file tree
components/base/upload-imgs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252 <div class =" preview" title =" 更换图片" @click.prevent.stop =" handleClick(item.id)" >
5353 <i class =" el-icon-edit" ></i >
5454 </div >
55- <div class =" control-bottom" >
55+ <div class =" control-bottom" v-if = " sortable || preview " >
5656 <i
57+ v-if =" sortable"
5758 title =" 前移"
5859 class =" control-bottom-btn el-icon-back"
5960 :class =" {disabled: (i === 0)}"
6061 @click.stop =" move(item.id, -1)" ></i >
61- <i class =" control-bottom-btn el-icon-view" title =" 预览" ></i >
6262 <i
63+ v-if =" preview"
64+ class =" control-bottom-btn el-icon-view"
65+ title =" 预览"
66+ @click.stop =" previewImg(item)" ></i >
67+ <i
68+ v-if =" sortable"
6369 title =" 后移"
6470 class =" control-bottom-btn el-icon-right"
6571 :class =" {disabled: (i === (itemList.length - 1))}"
@@ -381,6 +387,11 @@ export default {
381387 // 初始化 Draggable
382388 },
383389 methods: {
390+ previewImg (data ) {
391+ this .$confirm (` <img src="${ data .display } " style="width: 100%; height: 100%" />` , ' 预览' , {
392+ dangerouslyUseHTMLString: true ,
393+ })
394+ },
384395 move (id , step ) {
385396 const { itemList } = this
386397 // 找到操作的元素
Original file line number Diff line number Diff line change 2828 <el-form-item label =" 最大数量" >
2929 <upload-imgs :rules =" rules" :multiple =" true" :max-num =" 3" />
3030 </el-form-item >
31+ <el-form-item label =" 定制宽高-排序" >
32+ <upload-imgs :rules =" rules" :width =" 200" :height =" 150" :value =" initData" :sortable =" true" />
33+ </el-form-item >
34+ <el-form-item label =" 图像缩略图展示模式" >
35+ <upload-imgs :rules =" rules" :width =" 200" :height =" 150" fit =" cover" :value =" initData" />
36+ </el-form-item >
3137 </el-form >
3238 </div >
3339 </div >
@@ -60,6 +66,10 @@ export default {
6066 id: ' 12d3' ,
6167 display: ' http://img-home.7yue.pro/images/index/Lin_cms_%E5%B0%81%E9%9D%A2.png' ,
6268 src: ' http://img-home.7yue.pro/images/index/Lin_cms_%E5%B0%81%E9%9D%A2.png' ,
69+ }, {
70+ id: ' hahah' ,
71+ display: ' http://img-home.7yue.pro/images/index/Lin_UI_%E5%B0%81%E9%9D%A2.png' ,
72+ src: ' http://img-home.7yue.pro/images/index/Lin_UI_%E5%B0%81%E9%9D%A2.png' ,
6373 }],
6474 }
6575 },
You can’t perform that action at this time.
0 commit comments