Переглянути джерело

品牌导览数据为空处理

gcz 1 рік тому
батько
коміт
ae45d2ddc9
1 змінених файлів з 17 додано та 1 видалено
  1. 17 1
      brand/brand.vue

+ 17 - 1
brand/brand.vue

@@ -1,5 +1,15 @@
 <template>
-	<view class="">
+	<view class="" v-if="isEmpty">
+		<u-navbar
+			:placeholder="true"
+			title="品牌导览"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<u-empty mode="list" text="暂无数据" marginTop="200"></u-empty>
+	</view>
+	<view class="" v-else>
 		<!-- <view class="" :style="{height: navHeight+'px' }"></view> -->
 		<u-navbar
 			:placeholder="true"
@@ -105,6 +115,7 @@
 		},
 		data() {
 			return {
+				isEmpty:false,
 				staticUrl:this.$commonConfig.staticUrl,
 				floorIndex:0,
 				secondTypesIndex:0,
@@ -180,6 +191,8 @@
 				
 				// 如果希望先请求其他接口,再触发upCallback,可参考以下写法
 				if(!this.params.floorId){
+					this.mescroll.endErr();
+					this.isEmpty = true;
 					// this.selectBrandFloorTree();
 					return // 此处return,先获取xx
 				}
@@ -231,6 +244,9 @@
 			selectBrandFloorTree(){
 				this.$u.api.selectBrandFloorTree().then(res=>{
 					this.floorTree = res.data;
+					if(res.data.length>0){
+						this.isEmpty = false;
+					}
 					this.mescroll.resetUpScroll();
 				}).catch(err=>{
 					this.mescroll.endErr()