Skip to content

Instantly share code, notes, and snippets.

@OMGZui
Created June 13, 2022 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OMGZui/a484a1bd12e47982c3b7e387fe4191e7 to your computer and use it in GitHub Desktop.
Save OMGZui/a484a1bd12e47982c3b7e387fe4191e7 to your computer and use it in GitHub Desktop.
# html
<div class="control-main">
<div :class="`control-item control-item-${control}`" @click="changeControl"></div>
<div class="control-item"></div>
</div>
## js
changeControl() {
if (this.control < 3) {
this.control++;
} else {
this.control = 0;
}
}
## css
.control-item-1 {
transform: rotateZ(45deg);
}
.control-item-2 {
transform: rotateZ(90deg);
}
.control-item-3 {
transform: rotateZ(135deg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment