shopro-empty.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="shopro-empty-wrap u-flex-col u-row-center u-col-center" :style="{ 'margin-top': marginTop }">
  3. <image class="empty-img" :src="image" mode="aspectFill"></image>
  4. <view class="empty-text u-tips-color u-font-26">{{ tipText }}</view>
  5. <view class="btn-box u-m-t-100" v-if="btnText">
  6. <button class="u-reset-button empty-btn" :style="customStyle" hover-class="none" @tap="onBtn">{{ btnText }}</button>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. /**
  12. * shoproEmpty- 数据为空页
  13. * @property {String} image - 空白图。
  14. * @property {String} tipText - 提示语。
  15. * @property {String} btnText - 按钮文字。
  16. * @property {String} marginTop - 距离父级距离。
  17. * @property {Object} customStyle - 自定义按钮样式。
  18. * @event {Fuction} click - 点击按钮
  19. */
  20. export default {
  21. name: 'shoproEmpty',
  22. props: {
  23. image: {
  24. type: [String,null],
  25. default: '/static/images/empty_network.png'
  26. },
  27. tipText: {
  28. type: String,
  29. default: ''
  30. },
  31. btnText: {
  32. type: String,
  33. default: ''
  34. },
  35. marginTop: {
  36. type: String,
  37. default: '300rpx'
  38. },
  39. customStyle: {
  40. type: Object,
  41. default: () => {
  42. return {
  43. width: '200rpx',
  44. height: '70rpx',
  45. background: 'linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1))',
  46. borderRradius: '35rpx',
  47. fontSize: '28rpx',
  48. color: '#fff',
  49. border: 0
  50. };
  51. }
  52. }
  53. },
  54. methods: {
  55. onBtn() {
  56. this.$emit('click');
  57. }
  58. }
  59. };
  60. </script>
  61. <style lang="scss" scoped>
  62. .empty-img {
  63. width: 540rpx;
  64. height: 290rpx;
  65. }
  66. .empty-btn {
  67. width: 320rpx;
  68. height: 70rpx;
  69. line-height: 70rpx;
  70. background: linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1));
  71. border-radius: 35rpx;
  72. font-size: 28rpx;
  73. color: rgba(#fff, 0.9);
  74. }
  75. </style>