graceNvueFullLoading.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="grace-full-loading" v-if="graceFullLoading" :style="{backgroundColor:background}" @tap.stop="" @touchmove.stop="">
  3. <image class="grace-full-loading-image" ref="loadingLogos" :src="logoUrl" mode="widthFix" :style="{width:size, height:size}"></image>
  4. <text class="grace-full-loading-text" :style="{color:textColor, fontSize:fontSize}">{{text}}</text>
  5. </view>
  6. </template>
  7. <script>
  8. var animation = weex.requireModule('animation');
  9. export default {
  10. name: "graceFullLoading",
  11. props: {
  12. graceFullLoading: {
  13. type : Boolean,
  14. default : false
  15. },
  16. logoUrl : {
  17. type : String,
  18. default : ""
  19. },
  20. text : {
  21. type : String,
  22. default : "Loading ..."
  23. },
  24. fontSize : {
  25. type : String,
  26. default : "22rpx"
  27. },
  28. textColor : {
  29. type : String,
  30. default : "#999999"
  31. },
  32. size : {
  33. type : String,
  34. default : "138rpx"
  35. },
  36. background : {
  37. type : String,
  38. default : 'rgba(255,255,255,1)'
  39. }
  40. },
  41. updated : function(){
  42. setTimeout(()=>{
  43. var loadingLogos = this.$refs.loadingLogos;
  44. this.animation1(loadingLogos);
  45. }, 200);
  46. },
  47. methods: {
  48. animation1 : function(loadingLogos){
  49. var _self = this;
  50. animation.transition(loadingLogos, {
  51. styles: { opacity:0.3},
  52. duration: 1000,
  53. timingFunction: 'linear',
  54. needLayout:false,
  55. delay: 0
  56. }, function (){_self.animation2(loadingLogos);});
  57. },
  58. animation2 : function(loadingLogos){
  59. var _self = this;
  60. animation.transition(loadingLogos, {
  61. styles: { opacity: 1},
  62. duration: 1000,
  63. timingFunction: 'linear',
  64. needLayout:false,
  65. delay: 0
  66. }, function (){_self.animation1(loadingLogos);}
  67. );
  68. }
  69. }
  70. }
  71. </script>
  72. <style scoped>
  73. .grace-full-loading{width:750rpx; justify-content:center; align-items:center; background-color:rgba(255,255,255,0.9); position:fixed; left:0; top:0; bottom:0;}
  74. .grace-full-loading-image{width:150rpx; height:150rpx; border-radius:150rpx;}
  75. .grace-full-loading-text{line-height:50rpx; font-size:22rpx; margin-top:10rpx; text-align:center;}
  76. </style>