美文网首页
按钮切换动画

按钮切换动画

作者: 八妹sss | 来源:发表于2020-12-25 16:10 被阅读0次
<div class="btn-wrapper">
  <div class="slider"
    :class="{
       'to-left':currentChoose === 'latest',
       'to-right':currentChoose === 'hottest'
     }"></div>
 <ul class="btn-list">
   <li class="btn-item"
     @click="currentChoose = 'latest'"
     :class="{active: currentChoose === 'latest', android: !isIOS()}">最新</li>
   <li class="btn-item"
     @click="currentChoose = 'hottest'"
     :class="{active: currentChoose === 'hottest', android: !isIOS()}">最热</li>
 </ul>
</div>
<script>
import scroll from '@/components/scroll'
import tabScrollable from '../components/tabScrollable'
import newsBox from '../components/newsBox'
import liveBox from '../components/liveBox'
import openClassBox from '../components/openClassBox'
import videoBox from '../components/videoBox'
import pdfBox from '../components/pdfBox'
import previewVideo from '../components/previewVideo'
import noData from '@/views/components/noData'
export default {
  name: 'milkList',
  components: {
    scroll,
    tabScrollable,
    newsBox,
    liveBox,
    openClassBox,
    videoBox,
    pdfBox,
    previewVideo,
    noData
  },
  data () {
    return {
      // 最新最热文章相关
      currentChoose: 'latest'
    }
  }
}
</script>
<style lang="stylus" scoped>
    .btn-wrapper
      width 93px
      height 36px
      background #EAEAEA
      border-radius 18px
      position relative
      .slider
        width 48px
        height 36px
        background #FFC700
        color #000000
        border-radius 18px
        position absolute
        top 50%
        left 0
        transform translate(0, -50%)
        &.to-left
          left 0px
          transition left 0.5s
        &.to-right
          left 45px
          transition left 0.5s
      .btn-list
        width 93px
        height 36px
        border-radius 18px
        display flex
        align-items center
        position absolute
        top 50%
        left 50%
        transform translate(-50%, -50%)
        z-index 5
        .btn-item
          width 45px
          height 36px
          line-height 18px
          text-align center
          padded_box(border-box, 9px 0)
          font-size: 13px;
          font-family: 'PingFangSC-Regular', 'PingFang SC';
          color: #878B8D;
          &.android
            padding-top 11px
          &.active
            width 48px
            color #000000
            transition color 0.5s
</style>

效果图:


image.png

相关文章

  • 按钮切换动画

    效果图:

  • Vue学习整理(三)

    Vue 中的动画 需求:屏幕上有Hello World 文字,还有一个切换按钮,点击切换按钮,文字渐渐消失,再次点...

  • 按钮切换弹簧动画

    CocoaChina上有一篇视错觉结合UI:从一个看似简单的自定义控件说起,实现了一个比较有趣的的控件,尝试用ma...

  • 【cocos creator】skeleton切换动画BUG

    【现象】一个按钮中需要交替播放动画A和B,调用代码setAnimation()发现动画切换有问题,部分图片显示不出...

  • Tabbar按钮切换的动画效果

    首先继承UITabBarController创建自己的Controller实现代理UITabBarControll...

  • Tabbar隐藏动画

    和Tabbar按钮切换动画一样(上一篇)首先继承UITabBarController创建自己的Controller...

  • 10.2 Masonry按钮动画

    Masonry按钮动画 Masonry按钮动画1.png Masonry按钮动画2.png

  • Vue中CSS动画原理

    这个代码的网页显示如下: 点击切换按钮后,显示如下: 如果要有渐变式的动画效果,必须要加transition标签。...

  • Android - ValueAnimator+PathMeas

    一、效果展示 动画分为三种状态:Loading、Success、Fail,可以点击按钮切换状态。加载后成功的效果如...

  • macOS人机界面准则四—控件和拓展功能

    * 按钮 复选框、折叠控件、渐变按钮、帮助按钮、图像按钮、弹出按钮、下拉按钮、操作按钮、单选按钮、范围按钮、切换按...

网友评论

      本文标题:按钮切换动画

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