Skip to content

Commit

Permalink
fix(TabBar): resolved wx:key wrong (#3002)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarmywang authored Jul 25, 2024
1 parent dfcd484 commit ab35617
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/side-bar/_example/base/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<t-side-bar value="{{sideBarIndex}}" bind:change="onSideBarChange">
<t-side-bar-item
wx:for="{{categories}}"
wx:key="index"
wx:key="label"
value="{{item.value || index}}"
label="{{item.label}}"
badge-props="{{item.badgeProps}}"
Expand All @@ -15,7 +15,7 @@
<view wx:for="{{categories}}" wx:key="index" class="section">
<view class="title">{{item.title || item.label}}</view>
<t-grid column="{{3}}" border="{{false}}">
<block wx:for="{{item.items}}" wx:key="index" wx:for-item="cargo">
<block wx:for="{{item.items}}" wx:key="label" wx:for-item="cargo">
<t-grid-item
text="{{cargo.label}}"
image="{{cargo.image}}"
Expand Down
4 changes: 2 additions & 2 deletions src/side-bar/_example/custom/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<t-side-bar value="{{sideBarIndex}}" bind:change="onSideBarChange">
<t-side-bar-item
wx:for="{{categories}}"
wx:key="index"
wx:key="label"
value="{{item.value || index}}"
label="{{item.label}}"
badge-props="{{item.badgeProps}}"
Expand All @@ -15,7 +15,7 @@
<view wx:for="{{categories}}" wx:key="index" class="section">
<view class="title">{{item.title || item.label}}</view>
<t-grid column="{{3}}" border="{{false}}">
<block wx:for="{{item.items}}" wx:key="index" wx:for-item="cargo">
<block wx:for="{{item.items}}" wx:key="label" wx:for-item="cargo">
<t-grid-item
text="{{cargo.label}}"
image="{{cargo.image}}"
Expand Down
4 changes: 2 additions & 2 deletions src/side-bar/_example/switch/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<t-side-bar value="{{sideBarIndex}}" bind:change="onSideBarChange">
<t-side-bar-item
wx:for="{{categories}}"
wx:key="index"
wx:key="label"
value="{{item.value || index}}"
label="{{item.label}}"
disabled="{{item.disabled}}"
Expand All @@ -15,7 +15,7 @@
<view class="content" style="transform: translateY(-{{sideBarIndex * 100}}%)">
<scroll-view
wx:for="{{categories}}"
wx:key="index"
wx:key="label"
class="section"
scroll-y
scroll-top="{{scrollTop}}"
Expand Down
4 changes: 2 additions & 2 deletions src/side-bar/_example/with-icon/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<t-side-bar value="{{sideBarIndex}}" bind:change="onSideBarChange">
<t-side-bar-item
wx:for="{{categories}}"
wx:key="index"
wx:key="label"
value="{{item.value || index}}"
label="{{item.label}}"
icon="{{item.icon}}"
badge-props="{{item.badgeProps}}"
/>
</t-side-bar>
<scroll-view class="content" scroll-y scroll-with-animation scroll-top="{{scrollTop}}" bind:scroll="onScroll">
<view wx:for="{{categories}}" wx:key="index" class="section">
<view wx:for="{{categories}}" wx:key="label" class="section">
<view class="title">{{item.title || item.label}}</view>
<t-grid column="{{3}}" border="{{false}}">
<block wx:for="{{item.items}}" wx:key="index" wx:for-item="cargo">
Expand Down
2 changes: 1 addition & 1 deletion src/tab-bar-item/tab-bar-item.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
wx:for="{{subTabBar}}"
wx:for-item="child"
wx:for-index="index"
wx:key="index"
wx:key="value"
bind:tap="selectChild"
data-value="{{child.value || index}}"
aria-role="tab"
Expand Down
2 changes: 1 addition & 1 deletion src/tab-bar/_example/base/index.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<t-tab-bar t-class="t-tab-bar" value="{{value}}" bindchange="onChange" theme="tag" split="{{false}}">
<t-tab-bar-item wx:for="{{list}}" wx:key="index" value="{{item.value}}" icon="{{item.icon}}">
<t-tab-bar-item wx:for="{{list}}" wx:key="value" value="{{item.value}}" icon="{{item.icon}}">
{{item.label}}
</t-tab-bar-item>
</t-tab-bar>
2 changes: 1 addition & 1 deletion src/tab-bar/_example/custom/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<t-tab-bar t-class="t-tab-bar" value="{{value}}" bindchange="onChange">
<t-tab-bar-item
wx:for="{{list}}"
wx:key="index"
wx:key="value"
value="{{item.value}}"
icon="{{item.icon}}"
ariaLabel="{{item.ariaLabel}}"
Expand Down
2 changes: 1 addition & 1 deletion src/tab-bar/_example/icon-only/index.wxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<t-tab-bar t-class="t-tab-bar" value="{{value}}" bindchange="onChange" theme="tag" split="{{false}}">
<t-tab-bar-item
wx:for="{{list}}"
wx:key="index"
wx:key="value"
value="{{item.value}}"
icon="{{item.icon}}"
ariaLabel="{{item.ariaLabel}}"
Expand Down
2 changes: 1 addition & 1 deletion src/tab-bar/_example/round/index.wxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<t-tab-bar t-class="t-tab-bar" value="{{value}}" bindchange="onChange" shape="round" theme="tag" split="{{false}}">
<t-tab-bar-item
wx:for="{{list}}"
wx:key="index"
wx:key="value"
value="{{item.value}}"
icon="{{item.icon}}"
ariaLabel="{{item.ariaLabel}}"
Expand Down
2 changes: 1 addition & 1 deletion src/tab-bar/_example/sub/index.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<t-tab-bar t-class="t-tab-bar" defaultValue="label_3" theme="tag" split="{{false}}">
<t-tab-bar-item wx:for="{{list}}" wx:key="index" value="{{item.value}}" sub-tab-bar="{{item.children}}">
<t-tab-bar-item wx:for="{{list}}" wx:key="value" value="{{item.value}}" sub-tab-bar="{{item.children}}">
{{item.label}}
</t-tab-bar-item>
</t-tab-bar>

0 comments on commit ab35617

Please sign in to comment.