gui-skeleton.vue 932 B

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