empty.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view class="empty-content">
  3. <image class="empty-content-image" :src="setSrc" mode="aspectFit"></image>
  4. <text class="error-text">{{EmptyText}}</text>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. props: {
  10. src: {
  11. type: String,
  12. default: 'empty'
  13. },
  14. typeIndex:{
  15. type:String,
  16. default: 'empty'
  17. },
  18. navbarHeight:{
  19. type:Number
  20. }
  21. },
  22. data() {
  23. return {
  24. typeSrcall: {
  25. empty: 'https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AcewRAAEtqt4jZmU397.png',
  26. },
  27. typeSrc: {
  28. empty: 'https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AJZvwAAGWWe4DnXk371.png',
  29. },
  30. EmptyText:'',
  31. }
  32. },
  33. created(){
  34. if(this.typeIndex==0){
  35. this.EmptyText = '您还没有任何的订单哟~'
  36. }else{
  37. this.EmptyText = '您还没有相关的订单哟~'
  38. }
  39. },
  40. computed: {
  41. setSrc() {
  42. let url;
  43. if(this.typeIndex==0){
  44. url = this.typeSrcall[this.src]
  45. }else{
  46. url = this.typeSrc[this.src]
  47. }
  48. return url;
  49. },
  50. },
  51. }
  52. </script>
  53. <style lang="scss">
  54. .empty-content {
  55. display: flex;
  56. align-items: center;
  57. justify-content: center;
  58. flex-direction: column;
  59. position: fixed;
  60. top: 0;
  61. left: 0;
  62. bottom: 0;
  63. right: 0;
  64. margin: auto;
  65. background: $bg-color;
  66. z-index: 999;
  67. &-image {
  68. width: 382rpx;
  69. height: 310rpx;
  70. }
  71. .error-text{
  72. font-size: $font-size-28;
  73. color: $text-color;
  74. line-height: 88rpx;
  75. }
  76. }
  77. </style>