fix(组件): 修复tab组件中子组件moduleIndex冲突问题
为tab组件中的子组件添加tabIndex前缀,避免不同tab页中子组件的moduleIndex冲突
This commit is contained in:
@@ -317,7 +317,12 @@ export default {
|
||||
this.diyGlobalData.value.forEach((item, index) => {
|
||||
item.pageStyle = '';
|
||||
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
|
||||
item.moduleIndex = index + 1;
|
||||
// 如果是Tab组件内部的子组件,添加tabIndex前缀避免moduleIndex冲突
|
||||
if (this.diyData.tabIndex !== undefined) {
|
||||
item.moduleIndex = `${this.diyData.tabIndex}-${index + 1}`;
|
||||
} else {
|
||||
item.moduleIndex = index + 1;
|
||||
}
|
||||
|
||||
// 特殊处理搜索框 当显示位置为滚动至顶部固定时,只设置背景颜色
|
||||
if (item.componentName == 'Search' && item.positionWay == 'fixed') {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
:style="[panelStyle, activeTab === idx ? panelActiveStyle : {}]">
|
||||
<view v-if="tab.components && tab.components.length > 0" class="tab-components">
|
||||
<!-- 渲染每个标签下的组件 -->
|
||||
<diy-group v-if="tab.components" :diyData="{ value: tab.components, global: diyGlobal }"
|
||||
<diy-group v-if="tab.components" :diyData="{ value: tab.components, global: diyGlobal, tabIndex: idx }"
|
||||
:scrollTop="tab.scrollTop || 0" />
|
||||
</view>
|
||||
</view>
|
||||
@@ -49,7 +49,7 @@
|
||||
:style="[panelStyle, activeTab === idx ? panelActiveStyle : {}]">
|
||||
<view v-if="tab.components && tab.components.length > 0" class="tab-components">
|
||||
<!-- 渲染每个标签下的组件 -->
|
||||
<diy-group v-if="tab.components" :diyData="{ value: tab.components, global: diyGlobal }"
|
||||
<diy-group v-if="tab.components" :diyData="{ value: tab.components, global: diyGlobal, tabIndex: idx }"
|
||||
:scrollTop="tab.scrollTop || 0" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user