电子木鱼-Vue

css+vue+js => 电子木鱼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>电子木鱼</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
    <style>
       #app{
        width:500px;
        height:700px;
       }
      #app>button{
        background:url('../../click1.jpg');
        width:500px;
        height:500px;
        background-size:100%,100%;
        border:None;
        cursor:pointer;
      }
      #app>img{
        position:absolute;
        top:0px;
        right:330px;
        width:150px;
        height:50px;
        animation: mymove 2s 1 forwards;  <!--1指循环一次,可不写;forwards将动画定格在最后一刻-->
      }
      @keyframes mymove{
      from{opacity:1;
        transform: translateY(200px);
      }
        to {opacity:0;
         transform: translateY( -300px);}   <!--向上平移100px+160px-->
      }
    </style>
</head>
<body>
<div id="app" >
    <h2 style="text-align:center">已敲{{count}}功德 </h2>
  <button type="button" @click="click1()"  ></button>
    <img v-show="ok"  src="../../gongde.jpg" >


</div>
    <script>
      var vm=new Vue({
        el:'#app',
        data:{
          count:0,
          count1:0,
          ok:false,
        },
        methods:{
            click1:function(){
                this.count=this.count + 99;
                this.count1 = 2;
                this.ok = true;
                setTimeout(()=> {
			        this.ok = false;
		         }, 300);
            }
        }
      })
    </script>
</body>
</html>

click1.jpg => 

gongde.jpg=> 

最终结果:

电子木鱼

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值