hookehuyr

fix 多行产品标题函数适配优化

1 <!-- 1 <!--
2 * @Date: 2024-09-26 13:42:11 2 * @Date: 2024-09-26 13:42:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-23 15:26:14 4 + * @LastEditTime: 2024-10-23 17:05:50
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
72 <div class="product-left-wrapper"> 72 <div class="product-left-wrapper">
73 <div :class="['product-left-item', p_index === index ? 'active' : '']" v-for="(item, index) in product_menu" :key="index" @click="onClick(item, index)"> 73 <div :class="['product-left-item', p_index === index ? 'active' : '']" v-for="(item, index) in product_menu" :key="index" @click="onClick(item, index)">
74 <div class="icon-text"> 74 <div class="icon-text">
75 - <el-image style="width: auto; height: 1.65rem" :src="item.cover" fit="fit"></el-image> 75 + <el-image style="width: auto; height: 1.65rem" :src="item.icon" fit="fit"></el-image>
76 &nbsp; 76 &nbsp;
77 {{ item.category_name }} 77 {{ item.category_name }}
78 </div> 78 </div>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
94 <div v-for="(item, index) in product_info" :key="index" class="product-right-center-item"> 94 <div v-for="(item, index) in product_info" :key="index" class="product-right-center-item">
95 <div @click="goToC(item)" class="header-text">{{ item.category_name }}&nbsp;</div> 95 <div @click="goToC(item)" class="header-text">{{ item.category_name }}&nbsp;</div>
96 <div> 96 <div>
97 - <div class="item-text" @click="goToP(item)" v-for="(p, idx) in item.list" :key="idx">{{ p.product_name }}</div> 97 + <div class="item-text" @click="goToP(p)" v-for="(p, idx) in item.list" :key="idx">{{ p.product_name }}</div>
98 </div> 98 </div>
99 </div> 99 </div>
100 </div> 100 </div>
...@@ -222,23 +222,27 @@ export default { ...@@ -222,23 +222,27 @@ export default {
222 for (let i = 0; i < product.list?.length; i += maxLength) { 222 for (let i = 0; i < product.list?.length; i += maxLength) {
223 listChunks.push(product.list.slice(i, i + maxLength)); 223 listChunks.push(product.list.slice(i, i + maxLength));
224 } 224 }
225 + console.warn(listChunks);
225 226
226 // 第一个块保留原有的 name,后续块 name 设为空 227 // 第一个块保留原有的 name,后续块 name 设为空
227 listChunks.forEach((chunk, index) => { 228 listChunks.forEach((chunk, index) => {
228 if (index === 0) { 229 if (index === 0) {
229 result.push({ 230 result.push({
230 - name: product.product_name, 231 + id: product.id,
232 + category_name: product.category_name,
231 list: chunk 233 list: chunk
232 }); 234 });
233 } else { 235 } else {
234 result.push({ 236 result.push({
235 - name: '', 237 + id: '',
238 + category_name: '',
236 list: chunk 239 list: chunk
237 }); 240 });
238 } 241 }
239 }); 242 });
240 } 243 }
241 }); 244 });
245 + console.warn('res', result);
242 246
243 return result; 247 return result;
244 }, 248 },
...@@ -303,6 +307,7 @@ export default { ...@@ -303,6 +307,7 @@ export default {
303 id: item.id, 307 id: item.id,
304 } 308 }
305 }); 309 });
310 +
306 this.closeMenu(); 311 this.closeMenu();
307 }, 312 },
308 goToP (item) { // 跳转产品详情 313 goToP (item) { // 跳转产品详情
......