您当前的位置: 首页 > 

暂无认证

  • 0浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

vue+transition+opacity实现淡入淡出、过度、透明度

发布时间:2022-02-15 16:35:26 ,浏览量:0

目录
  • 1、HTML部分
  • 2、JavaScript部分
  • 3、css部分
  • 4、效果演示
    • 4.1、微信小程序码
    • 4.2、普通二维码
  • 5、完整代码
1、HTML部分
<div id="app"> <div class="transition-box"> <div :class="{transition: true, 'is-show': isShow}" @click="clickSwitch"> <span style="font-size: 27px; font-weight: 700;">点击切换 el: "#app", data() { return { isShow: false, } }, methods: { clickSwitch() { this.isShow = !this.isShow; } } }); 
3、css部分
.transition-box { width: 150px; display: flex; flex-direction: column; align-items: center; } .transition { width: 150px; height: 70px; line-height: 70px; text-align: center; background-color: #E6A23C; border-radius: 30px; cursor: pointer; /* 过度 */ transition: all 1s; /* 透明度为0,完全透明 */ opacity: .3; } .is-show { height: 150px; line-height: 150px; border-radius: 0; /* 透明度为1,就是不透明 */ opacity: 1; } 
4、效果演示 4.1、微信小程序码

2.0.2X

4.2、普通二维码

2.0.2P

5、完整代码

gitee(码云) - develop分支 - fadeInFadeOut 文件夹

关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.3522s