hookehuyr

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

<!--
* @Date: 2024-09-26 13:42:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-10-23 15:26:14
* @LastEditTime: 2024-10-23 17:05:50
* @FilePath: /hager/src/components/common/hagerHeader.vue
* @Description: 文件描述
-->
......@@ -72,7 +72,7 @@
<div class="product-left-wrapper">
<div :class="['product-left-item', p_index === index ? 'active' : '']" v-for="(item, index) in product_menu" :key="index" @click="onClick(item, index)">
<div class="icon-text">
<el-image style="width: auto; height: 1.65rem" :src="item.cover" fit="fit"></el-image>
<el-image style="width: auto; height: 1.65rem" :src="item.icon" fit="fit"></el-image>
&nbsp;
{{ item.category_name }}
</div>
......@@ -94,7 +94,7 @@
<div v-for="(item, index) in product_info" :key="index" class="product-right-center-item">
<div @click="goToC(item)" class="header-text">{{ item.category_name }}&nbsp;</div>
<div>
<div class="item-text" @click="goToP(item)" v-for="(p, idx) in item.list" :key="idx">{{ p.product_name }}</div>
<div class="item-text" @click="goToP(p)" v-for="(p, idx) in item.list" :key="idx">{{ p.product_name }}</div>
</div>
</div>
</div>
......@@ -222,23 +222,27 @@ export default {
for (let i = 0; i < product.list?.length; i += maxLength) {
listChunks.push(product.list.slice(i, i + maxLength));
}
console.warn(listChunks);
// 第一个块保留原有的 name,后续块 name 设为空
listChunks.forEach((chunk, index) => {
if (index === 0) {
result.push({
name: product.product_name,
id: product.id,
category_name: product.category_name,
list: chunk
});
} else {
result.push({
name: '',
id: '',
category_name: '',
list: chunk
});
}
});
}
});
console.warn('res', result);
return result;
},
......@@ -303,6 +307,7 @@ export default {
id: item.id,
}
});
this.closeMenu();
},
goToP (item) { // 跳转产品详情
......