gui-loadmore.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view
  3. class="gui-load-more gui-flex gui-rows gui-align-items-center gui-justify-content-center"
  4. v-if="!hidden"
  5. @tap.stop.prevent="tapme">
  6. <view
  7. class="gui-load-more-icon"
  8. ref="loadingiconforloadmore"
  9. v-if="loadMoreStatus == 1">
  10. <text
  11. class="gui-icons gui-rotate360 gui-block-text"
  12. :style="{
  13. fontSize:loadMoreFontSize,
  14. color:loadMoreColor[loadMoreStatus]}">&#xe9db;</text>
  15. </view>
  16. <text
  17. class="gui-block-text"
  18. :style="{
  19. fontSize:loadMoreFontSize,
  20. color:loadMoreColor[loadMoreStatus]
  21. }">{{loadMoreText[loadMoreStatus]}}</text>
  22. </view>
  23. </template>
  24. <script>
  25. // #ifdef APP-NVUE
  26. var animation = weex.requireModule('animation');
  27. // #endif
  28. export default{
  29. name : "gui-loadmore",
  30. props : {
  31. loadMoreText : {type:Array, default:function () {
  32. return ['','更多数据加载中', '已加载全部数据', '暂无数据'];
  33. }},
  34. loadMoreColor : {type:Array, default:function () {
  35. return ['rgba(69, 90, 100, 0.6)', 'rgba(69, 90, 100, 0.6)', 'rgba(69, 90, 100, 0.8)', 'rgba(69, 90, 100, 0.6)'];
  36. }},
  37. loadMoreFontSize : {type:String, default:'26rpx'},
  38. status : {type:Number, default:0},
  39. },
  40. data() {
  41. return {
  42. loadMoreStatus : 0,
  43. hidden : false
  44. }
  45. },
  46. created:function(){
  47. this.loadMoreStatus = this.status;
  48. },
  49. methods:{
  50. loading : function(){
  51. this.loadMoreStatus = 1;
  52. // #ifdef APP-NVUE
  53. setTimeout(()=>{
  54. this.rotate360();
  55. }, 200);
  56. // #endif
  57. },
  58. stoploadmore : function(){
  59. this.loadMoreStatus = 0;
  60. },
  61. nomore : function(){
  62. this.loadMoreStatus = 2;
  63. },
  64. empty : function(){
  65. this.loadMoreStatus = 3;
  66. },
  67. hide : function(){
  68. this.hidden = true;
  69. },
  70. rotate360 : function(){
  71. var el = this.$refs.loadingiconforloadmore;
  72. animation.transition(el, {
  73. styles : {transform: 'rotate(7200deg)'},
  74. duration : 20000,
  75. timingFunction: 'linear',
  76. needLayout :false,
  77. delay: 0
  78. });
  79. },
  80. tapme : function(){
  81. if(this.loadMoreStatus == 0){
  82. this.$emit('tapme');
  83. }
  84. }
  85. }
  86. }
  87. </script>
  88. <style scoped>
  89. .gui-load-more{overflow:hidden; padding:25rpx;}
  90. .gui-load-more-text{line-height:35rpx;}
  91. .gui-load-more-icon{padding:0 12rpx; line-height:35rpx;}
  92. </style>