How to trigger a vue method only once, not every time

后端 未结 3 1537
情深已故
情深已故 2021-01-11 10:28

I\'m handling a rotate even on change:

3条回答
  •  逝去的感伤
    2021-01-11 10:35

    If rotate start always at zero you can do:

    export default {
        data: {
            rotate = 0
        },
        methods: {
            handleRotate(e) {
                if (this.rotate !== 0) {
                    return;
                }
                this.rotate = this.rotate + this.getRotateAngle(e.clientX, e.clientY);
            }
        }
    };
    

提交回复
热议问题