mescroll-down.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!-- 下拉刷新区域 -->
  2. <template>
  3. <view v-if="mOption.use" class="mescroll-downwarp" :style="{'background':mOption.bgColor,'color':mOption.textColor}">
  4. <view class="downwarp-content">
  5. <view v-if="isDownLoading" class="downwarp-progress"></view>
  6. <view v-else class="downwarp-arrow" :style="{ transform: downRotate }"></view>
  7. <view class="downwarp-tip">{{ downText }}</view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. props: {
  14. option: Object, // down的配置项
  15. type: Number // 下拉状态(inOffset:1, outOffset:2, showLoading:3, endDownScroll:4)
  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 this.type === 2 ? 'rotate(-180deg)' : 'rotate(0deg)';
  29. },
  30. // 文本提示
  31. downText() {
  32. switch (this.type) {
  33. case 1:
  34. return this.mOption.textInOffset;
  35. case 2:
  36. return this.mOption.textOutOffset;
  37. case 3:
  38. return this.mOption.textLoading;
  39. case 4:
  40. return this.mOption.textLoading;
  41. default:
  42. return this.mOption.textInOffset;
  43. }
  44. }
  45. }
  46. };
  47. </script>
  48. <style>
  49. @import '../../../mescroll-uni/components/mescroll-down.css';
  50. @import './mescroll-down.css';
  51. </style>