NoData.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="nodata" v-if="show">
  3. <view class="main" :style="{paddingTop:topNum+'%'}">
  4. <image class="nodata-img" mode="widthFix" :src="backImageUrl?backImageUrl+imgUrl:''"></image>
  5. <text class="nodata-content" v-if="content">{{ content || '' }}</text>
  6. <text class="nodata-title" v-if="title">{{ title || '' }}</text>
  7. <text class="nodata-desc" v-if="desc">{{ desc || '' }}</text>
  8. </view>
  9. </view>
  10. </template>
  11. <script lang='ts'>
  12. import {
  13. Component,
  14. Prop,
  15. Vue
  16. } from 'vue-property-decorator';
  17. // import {
  18. // Getter,
  19. // Mutation
  20. // } from 'vuex-class';
  21. import {
  22. OSS_STATIC
  23. } from '@/common/constants';
  24. @Component({})
  25. export default class NoData extends Vue {
  26. @Prop({
  27. default: false
  28. }) show ? : boolean; //是否展示
  29. @Prop({
  30. default: 30
  31. }) topNum ? : number; //距离顶部的距离
  32. @Prop({
  33. default: "没有数据"
  34. }) title ? : string; //title展示
  35. @Prop({
  36. default: ""
  37. }) content ? : string; //content展示
  38. @Prop({
  39. default: ""
  40. }) desc ? : string; //desc展示
  41. @Prop({
  42. default: "search-empty.svg"
  43. }) imgUrl ?: string;
  44. backImageUrl: string = OSS_STATIC //oss地址
  45. created() {}
  46. mounted() {}
  47. //methods---------------
  48. }
  49. </script>
  50. <style lang='scss' scoped>
  51. .nodata {
  52. position: relative;
  53. text-align: center;
  54. .main {
  55. @include flex-y();
  56. .nodata-img {
  57. margin-bottom: vw(10);
  58. /* @include wh(148, 146); */
  59. width: vw(200);
  60. /* flex: 0; */
  61. }
  62. .nodata-content {
  63. @include word-vw(16, #333333);
  64. font-weight: bold;
  65. }
  66. .nodata-title {
  67. /* margin-top: vw(6); */
  68. flex: 0;
  69. /* width: vw(200); */
  70. font-size: vw(14);
  71. color: $gray9;
  72. line-height: vw(19);
  73. }
  74. .nodata-desc {
  75. flex: 1;
  76. width: vw(200);
  77. line-height: vw(19);
  78. font-size: vw(12);
  79. color: $gray9;
  80. margin-top: vw(10);
  81. }
  82. }
  83. }
  84. </style>