关于对vue-particle-effect-button的使用

#想要的效果:触发某个事件后,有粒子动画(可能解释的不太清除...),直接写文章了

1、先奉上地址:https://www.npmjs.com/package/vue-particle-effect-button

2、效果demo的地址:https://transitive-bullshit.github.io/react-particle-effect-button/

3、怎么用呢(api就不说了...):

<template>
  <div>
    <particle-effect-button
      :hidden="isHidden"
      color="#000"
      :duration="500"
      type="triangle"
      drawStyle="stroke"
    >
      <div style="padding: 20px;background-color: burlywood;border-radius: 10px">上一个</div>
    </particle-effect-button>
    <el-button @click="particleEffect()">执行粒子动画</el-button>
  </div>
</template>

<script>
  import ParticleEffectButton from 'vue-particle-effect-button'
  export default {
    name: "StudyParticleEffectsButton",
    components: {
      ParticleEffectButton
    },
    data() {
      return {
        isHidden: false,
      }
    },
    methods:{
      particleEffect(){
        this.isHidden=!this.isHidden;
      },
    },
  }
</script>

<style scoped>

</style>

4、发现的问题:

在particle-effect-button标签中嵌入elementUI的标签,比如el-button、会出现在完成粒子动画之后再闪烁一下的毛病

5、解决方法:

自己再写一个方法吧...,在需要隐藏的方法上绑定v-show='showTabbar',然后再在particleEffect方法中添加一段代码,

手动设置关闭(阻止连续点击的方法没写,可以设置一个setTimeout(() => { //doSomething...}, 500);我的思路就是这样。)

if (this.isHidden==false){
  this.showTabbar=true;
} else {
  setTimeout(() => {
    this.showTabbar=false;
  }, 500);
}

猜你喜欢

转载自blog.csdn.net/qq_36022290/article/details/84889911
今日推荐