js实现图片滚轮、按钮缩放大小,图片旋转,图片拖拽

JavaScript051

js实现图片滚轮、按钮缩放大小,图片旋转,图片拖拽,第1张

<div class="upload-img-box" ref="moveWrap">

<div class="show-box" ref="rotate" @mousedown="moveImg" @mousewheel.prevent="rollImg($event,)">

<img :src="singleList.fileImgUrl" class="uploadimg" ref="img" :style="{transform:'scale('+multiples/100+') rotate('+rotate +'deg)'}"/>

</div>

<div class="img-plus" @click="toBIgChange()"><span class="tip">放大</span></div>

<div class="img-minus" @click="toSmallChange()"><span class="tip">缩小</span></div>

<div class="img-rotate" @click="toRotate()"><span class="tip">旋转</span></div>

</div>

直接设置图片对象的宽高即可。

var img=document.getElementById("photo")

img.width=200img.height=200

也可以设置style

img.style.width="200px"img.style.height="200px"