bg.vue 716 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <div class="module-background" :style="style"></div>
  3. </template>
  4. <script>
  5. export default{
  6. name:'moduleBg',
  7. props:['base'],
  8. computed:{
  9. style(){
  10. let bg = '';
  11. if(this.base.bg==2){ bg = 'background:none;';}
  12. else if(this.base.bg==3){
  13. if(this.base.bt==1){ bg = `background:${this.base.bc};`; }
  14. else if(this.base.bt==2 && this.base.bi!=''){ bg = `background:url(${this.base.bi}) no-repeat center;background-size:cover;`; }
  15. }
  16. return bg;
  17. }
  18. }
  19. }
  20. </script>
  21. <style>
  22. .module-background {
  23. background: #fff;
  24. position: absolute;
  25. left: 0;
  26. top: 0;
  27. right: 0;
  28. bottom: 0;
  29. }
  30. </style>