图片旋转预览

1.dom

![](/src/assets/image/rotate_r.png) ![](/src/assets/image/rotate_r.png)
``` ![](filePath) ``` ![](filePath)

2.js

引入jquery旋转插件

// 旋转图片
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;
},

你可能感兴趣的:(图片旋转预览)