nodata.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="no-data-view" :style="{'margin-top':conf.top+'vh'}">
  3. <image v-if="conf.imgUrl" :style="{width:conf.imgWidth,height:config.imgHeight}" :src="conf.imgUrl?conf.imgUrl:'@/static/nodata.png'"></image>
  4. <image v-if="!conf.imgUrl" class="no-data" src="@/static/nodata.png"></image>
  5. <view :style="{color:conf.color,'font-size':conf.fSize,'padding-top':conf.txtTop+'rpx'}">{{conf.content}}</view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. name: 'nodata',
  11. props:{
  12. config:{
  13. type:Object,
  14. default:function(){
  15. return{
  16. }
  17. }
  18. },
  19. },
  20. data() {
  21. return {
  22. conf:{
  23. type:'1',
  24. top:22,
  25. imgWidth:0,
  26. imgHeight:0,
  27. imgUrl:'',
  28. content:'没有商品了~',
  29. fSize:30,
  30. color:'#B3B3B3',
  31. txtTop:20,
  32. }
  33. }
  34. },
  35. created() {
  36. this.init();
  37. },
  38. methods: {
  39. init(){
  40. this.conf = Object.assign(this.conf, this.config);
  41. }
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. .no-data-view{
  47. text-align: center;
  48. }
  49. .no-data{
  50. width: 475rpx;
  51. height: 335rpx;
  52. }
  53. </style>