Authored by 郭成尧

没有店铺时不显示头部

1 <template> 1 <template>
2 - <div class="brand-top-box" v-bind:style="{ 'background-image': `url(${brandIntro.brandBg})` }"> 2 + <div v-if="showBrandInfo" class="brand-top-box" v-bind:style="{ 'background-image': `url(${brandIntro.brandBg})` }">
3 <div class="brand-bottom"> 3 <div class="brand-bottom">
4 <img v-if="brandIntro.showBrandLogo" v-lazy="brandIntro.brandLogo" alt="{{ brandIntro.brandName }}"> 4 <img v-if="brandIntro.showBrandLogo" v-lazy="brandIntro.brandLogo" alt="{{ brandIntro.brandName }}">
5 <div v-else class="brand-title">{{ brandIntro.brandName }}</div> 5 <div v-else class="brand-title">{{ brandIntro.brandName }}</div>
@@ -78,7 +78,6 @@ @@ -78,7 +78,6 @@
78 78
79 .collapse { 79 .collapse {
80 background: url("/channel/collapse.png") no-repeat; 80 background: url("/channel/collapse.png") no-repeat;
81 -  
82 } 81 }
83 } 82 }
84 </style> 83 </style>
@@ -91,7 +90,8 @@ @@ -91,7 +90,8 @@
91 data() { 90 data() {
92 return { 91 return {
93 brandIntro: {}, 92 brandIntro: {},
94 - showMore: false 93 + showMore: false,
  94 + showBrandInfo: false
95 }; 95 };
96 }, 96 },
97 watch: { 97 watch: {
@@ -109,7 +109,10 @@ @@ -109,7 +109,10 @@
109 url: '/get-brand-intro', 109 url: '/get-brand-intro',
110 data: data 110 data: data
111 }).then(result => { 111 }).then(result => {
112 - this.brandIntro = result; 112 + if (result) {
  113 + this.showBrandInfo = true;
  114 + this.brandIntro = result;
  115 + }
113 }).fail(() => { 116 }).fail(() => {
114 tip('网络错误'); 117 tip('网络错误');
115 }); 118 });