app-head.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <image class="head-bg" :style="{'height': height}" :src="head"></image>
  3. </template>
  4. <script>
  5. import {mapGetters, mapState} from 'vuex';
  6. export default {
  7. name: 'app-head',
  8. props: {
  9. height: {
  10. type: String,
  11. default() {
  12. return '360rpx';
  13. }
  14. },
  15. theme: String
  16. },
  17. data() {
  18. return {
  19. head: '',
  20. }
  21. },
  22. computed: {
  23. ...mapState({
  24. community: state => state.mallConfig.__wxapp_img.community,
  25. })
  26. },
  27. mounted() {
  28. let that = this;
  29. that.head = that.community.a;
  30. switch(that.theme) {
  31. case 'b':
  32. that.head = that.community.b;
  33. break;
  34. case 'c':
  35. that.head = that.community.c;
  36. break;
  37. case 'd':
  38. that.head = that.community.d;
  39. break;
  40. case 'e':
  41. that.head = that.community.e;
  42. break;
  43. case 'g':
  44. that.head = that.community.g;
  45. break;
  46. case 'h':
  47. that.head = that.community.h;
  48. break;
  49. case 'i':
  50. that.head = that.community.i;
  51. break;
  52. }
  53. }
  54. }
  55. </script>
  56. <style scoped lang="scss">
  57. .head-bg {
  58. width: #{750rpx};
  59. height: #{360rpx};
  60. }
  61. </style>