gui-skeleton.vue 819 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <view>
  3. <view class="gui-skeleton-animate"
  4. :style="styles"
  5. v-if="!show"></view>
  6. <view v-if="show">
  7. <slot></slot>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default{
  13. name : "gui-skeleton",
  14. data() {
  15. return {
  16. show:false
  17. }
  18. },
  19. props:{
  20. styles : {type : String, default : ''},
  21. delayTime : {type : Number, default : 800},
  22. canShow : {type : Boolean, default : true}
  23. },
  24. created:function(){
  25. setTimeout(()=>{
  26. if(this.canShow){this.show = true;}
  27. }, this.delayTime);
  28. }
  29. }
  30. </script>
  31. <style scoped>
  32. /* #ifndef APP-NVUE */
  33. @keyframes gui-skeleton-animate{0%{opacity:1;} 25%{opacity:0.5;} 50%{opacity:0.6;} 75%{opacity:1;} 100%{opacity:1;}}
  34. .gui-skeleton-animate{animation:gui-skeleton-animate 1.6s ease-in infinite;}
  35. /* #endif */
  36. </style>