mescroll-down.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!-- 下拉刷新区域 -->
  2. <template>
  3. <view v-if="mOption.use" class="mescroll-downwarp" :style="{'background-color':mOption.bgColor,'color':mOption.textColor}">
  4. <view class="downwarp-content">
  5. <view class="downwarp-progress" :class="{'mescroll-rotate': isDownLoading}" :style="{'border-color':mOption.textColor, 'transform':downRotate}"></view>
  6. <view class="downwarp-tip">{{downText}}</view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. props: {
  13. option: Object , // down的配置项
  14. type: Number, // 下拉状态(inOffset:1, outOffset:2, showLoading:3, endDownScroll:4)
  15. rate: Number // 下拉比率 (inOffset: rate<1; outOffset: rate>=1)
  16. },
  17. computed: {
  18. // 支付宝小程序需写成计算属性,prop定义default仍报错
  19. mOption(){
  20. return this.option || {}
  21. },
  22. // 是否在加载中
  23. isDownLoading(){
  24. return this.type === 3
  25. },
  26. // 旋转的角度
  27. downRotate(){
  28. return 'rotate(' + 360 * this.rate + 'deg)'
  29. },
  30. // 文本提示
  31. downText(){
  32. switch (this.type){
  33. case 1: return this.mOption.textInOffset;
  34. case 2: return this.mOption.textOutOffset;
  35. case 3: return this.mOption.textLoading;
  36. case 4: return this.mOption.textLoading;
  37. default: return this.mOption.textInOffset;
  38. }
  39. }
  40. }
  41. };
  42. </script>
  43. <style>
  44. @import "./mescroll-down.css";
  45. </style>