cm-empty.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <view class="cm-empty" :style="[offsetValue]">
  3. <image :src="image" mode="widthFix"></image> <text>{{ message }}</text>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'cm-empty',
  9. props: {
  10. message: {
  11. type: String,
  12. default: ''
  13. },
  14. image: {
  15. type: String,
  16. default: ''
  17. },
  18. offset: {
  19. type: [String, Number],
  20. default: 0
  21. }
  22. },
  23. computed: {
  24. offsetValue() {
  25. if (typeof this.offset === 'string') {
  26. return {
  27. transform: `translateY(${this.offset})`
  28. }
  29. }else{
  30. return {
  31. transform: `translateY(${this.offset}%)`
  32. }
  33. }
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. .cm-empty {
  40. width: 100%;
  41. height: 100%;
  42. display: flex;
  43. justify-content: center;
  44. align-items: center;
  45. flex-direction: column;
  46. image {
  47. width: 50%;
  48. }
  49. text {
  50. font-size: 26rpx;
  51. color: #999999;
  52. }
  53. }
  54. </style>