瀏覽代碼

首页跳转

skyblued 3 年之前
父節點
當前提交
f9800a2910

+ 7 - 1
src/views/shop-mall/components/hot-goods/index.tsx

@@ -14,6 +14,10 @@ export default defineComponent({
     hotProductList: {
       type: Array,
       default: []
+    },
+    onOpenWebView: {
+      type: Function,
+      default: (n: any) => {}
     }
   },
   render() {
@@ -43,7 +47,9 @@ export default defineComponent({
         </Row>
         <div class={styles.hotGoodsSection}>
           {this.hotProductList.map((item: any) => (
-            <div class={styles.hotGoodsItem}>
+            <div class={styles.hotGoodsItem} onClick={() => {
+              this.onOpenWebView('/goodsDetail?id=' + item.id)
+            }}>
               <Image
                 class={styles.hotGoodsItemImg}
                 src={item.pic}

+ 12 - 1
src/views/shop-mall/components/menu-list/index.tsx

@@ -8,6 +8,10 @@ export default defineComponent({
     productList: {
       type: Array,
       default: []
+    },
+    onOpenWebView: {
+      type: Function,
+      default: (a: any) => {}
     }
   },
   render() {
@@ -24,7 +28,14 @@ export default defineComponent({
         {this.productList.map((product: any) => (
           <SwipeItem class={styles.typeSection}>
             {product.map((item: any) => (
-              <div class={styles.typeItem}>
+              <div
+                class={styles.typeItem}
+                onClick={() => {
+                  this.onOpenWebView(
+                    '/goodsList?' + 'id=' + item.id + '&tag=' + encodeURIComponent(item.name)
+                  )
+                }}
+              >
                 <Image
                   class={styles.swipeTypeImg}
                   src={item.icon}

+ 18 - 1
src/views/shop-mall/components/tab-list/index.tsx

@@ -31,6 +31,14 @@ export default defineComponent({
     keyword: {
       type: String as any,
       defalut: ''
+    },
+    isTab: {
+      type: Boolean,
+      default: false
+    },
+    onOpenWebView: {
+      type: Function,
+      default: (a: any) => {}
     }
   },
   data() {
@@ -63,7 +71,7 @@ export default defineComponent({
       this.params.pageNum = 1
       if (!this.dataShow) this.getList() // list组件没有触发, 手动触发获取数据
       this.dataShow = true
-      
+
       // this.getList()
     },
     async getList() {
@@ -98,6 +106,15 @@ export default defineComponent({
       }
     },
     onDetailClick(item: any) {
+      if (this.isTab) {
+        let url = this.$router.resolve({
+          path: '/goodsDetail',
+          query: { id: item.id }
+        }).fullPath
+
+        this.onOpenWebView(url)
+        return
+      }
       this.$router.push({
         path: '/goodsDetail',
         query: {