Browse Source

no message

DaMowang 3 năm trước cách đây
mục cha
commit
64d6ca4859
1 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 8 2
      src/pages/product/productRetail.vue

+ 8 - 2
src/pages/product/productRetail.vue

@@ -14,6 +14,7 @@
             </view>
         </view>
         <!-- 商品列表-end -->
+      <not-goods v-if="haveGoods" textStr="暂无商品信息"></not-goods>
     </view>
 </template>
 <script>
@@ -22,13 +23,15 @@ let app = getApp();
 var appEv = app.$vm.$options;
 import { get, post } from "@/request/api.js";
 import uniPopup from '@/components/uni-popup/uni-popup.vue'
+import notGoods from "@/components/not-goods/index.vue";
 export default {
-    components: { uniPopup },
+    components: { uniPopup, notGoods },
     data() {
         return {
             goods: [], // 商品列表
             type: '',
             title: '',
+            haveGoods: false, // 是否有商品
         };
     },
     onLoad(e) {
@@ -54,7 +57,7 @@ export default {
                 if (res.code === 0) {
                     let obj = res.data.data
                     if (page == 1) that.goods = []
-                    if (obj.length > 0) {
+                    if (obj.length) {
                         obj.forEach(e => {
                             that.goods.push(e)
                         });
@@ -62,8 +65,11 @@ export default {
                         page = -1;
                         appEv.errTips('暂无更多')
                     }
+                    if(page == 1 && !obj.length) this.haveGoods = true
+                    else this.haveGoods = false
                 } else {
                     page = -1;
+                    this.haveGoods = true;
                     appEv.errTips('暂无更多')
                 }