skyblued %!s(int64=3) %!d(string=hai) anos
pai
achega
40fda153c6
Modificáronse 1 ficheiros con 17 adicións e 12 borrados
  1. 17 12
      src/views/shop-mall/index.tsx

+ 17 - 12
src/views/shop-mall/index.tsx

@@ -63,11 +63,17 @@ export default defineComponent({
     removeListenerMessage('UpdateToken', () => {})
   },
   methods: {
-    onSearch() {},
+    onRefresh() {
+      this.productCategoryList = []
+      this.$nextTick(() => {
+        this.init()
+      })
+      const tabFirst = this.$refs.tabFirst as any
+      tabFirst?.onSearch()
+    },
     async init() {
       try {
         const res = await request.get('/api-mall-portal/home/content')
-        console.log(res)
         const result = res.data || {}
         this.count = result.count
         cartCount.value = result.count
@@ -145,7 +151,7 @@ export default defineComponent({
           v-model={this.loading}
           loading-text="正在刷新..."
           success-text="刷新完成"
-          onRefresh={() => this.init()}
+          onRefresh={() => this.onRefresh()}
         >
           <div
             onClick={() => {
@@ -193,15 +199,14 @@ export default defineComponent({
             offsetTop={this.height}
             lazyRender
           >
-            {this.productCategoryList.length > 0 && (
-              <Tab title="全部" name={0}>
-                <TabList
-                  isTab={true}
-                  productAttributeCategoryId={0}
-                  onOpenWebView={this.openWebView}
-                />
-              </Tab>
-            )}
+            <Tab title="全部" name={0}>
+              <TabList
+                ref="tabFirst"
+                isTab={true}
+                productAttributeCategoryId={0}
+                onOpenWebView={this.openWebView}
+              />
+            </Tab>
             {this.productCategoryList.map((item: any) => (
               <Tab title={item.name} name={item.id}>
                 <TabList