1.dom
<div>
<div class="rotate-icon">
![](/src/assets/image/rotate_r.png)
![](/src/assets/image/rotate_r.png)
</div>
<div>
```
![](filePath)
```
![](filePath)
</div>
</div>
2.js
引入jquery旋转插件
<script src="/src/assets/js/jquery.rotate.js"></script>
// 旋转图片
rotateImg(type) {
let rot = this.rot;
if (type == "left") {
if (rot === -360) {
rot = 0;
}
rot -= 90;
$("#rotImg").rotate(-90);
}
if (type == "right") {
if (rot === 360) {
rot = 0;
}
rot += 90;
$("#rotImg").rotate(90);
}
this.rot = rot;
},
网友评论