美文网首页
vue箭头旋转

vue箭头旋转

作者: iOS乐乐 | 来源:发表于2021-03-10 17:20 被阅读0次

HTML

<div class="rowDiv" @click="arrowClick">
      <span>我是标题信息</span>
      <img src="~assets/images/arrow.png" alt="" :class="{icon: true, iconTrans:rotate}">
 </div>

JS

data(){
  return{
    rotate:false
  }
}
methods:{
  arrowClick(){
   this. rotate = !this. rotate
  }
}

CSS

.rowDiv{
    display: flex;
    /*justify-content: center;*/
    align-items: center;
    background: #4cd964;
    margin-top: 20px;
    height: 50px;
    span{
      text-align: left;
      flex: 1;
    }
    img{

    }
  }
  .icon {
    -webkit-transition: transform .25s linear;
    -moz-transition: transform .25s linear;
    -o-transition: transform .25s linear;
    transition: transform .25s linear;
  }
  .iconTrans {
    transform: rotate(180deg);
    -webkit-transition: transform .25s linear;
    -moz-transition: transform .25s linear;
    -o-transition: transform .25s linear;
    transition: transform .25s linear;
  }

相关文章

网友评论

      本文标题:vue箭头旋转

      本文链接:https://www.haomeiwen.com/subject/zdnwqltx.html