Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bladeView): fix sticky style and value name #214

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/pages/BladeView/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<blade-view
data="{{groups}}"
scrollToKey="S"
selectValue="{{selectValue}}"
value="{{value}}"
onChange="onChange"
sticky={{false}}
></blade-view>
Expand Down
4 changes: 2 additions & 2 deletions demo/pages/BladeView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const groups = Array(26)
Page({
data: {
groups,
selectValue: undefined,
value: undefined,
},
onChange(item, group) {
console.log(item, group)
this.setData({ selectValue: item.value });
this.setData({ value: item.value });
},
});
4 changes: 2 additions & 2 deletions src/BladeView/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
data-key="{{group.key}}"
>
<view
class="amd-blade-view-body-group-title {{ groupIndex ? '': 'firstBorder' }} {{sticky && currentKey===group.key ? 'sticky' : ''}}"
class="amd-blade-view-body-group-title {{ groupIndex ? '': 'amd-blade-view-body-group-title-first' }} {{sticky && currentKey===group.key ? 'amd-blade-view-body-group-title-sticky' : ''}}"
id="amd-blade-view-group-title-{{group.key}}"
>
{{group.title}}
Expand All @@ -33,7 +33,7 @@
data-group="{{group}}"
onTap="onTapItem"
>
<view class="amd-blade-view-body-group-item-text {{ index ? 'notFirstBorder': '' }} {{selectValue===item.value ? 'selected' : ''}}">
<view class="amd-blade-view-body-group-item-text {{ index ? 'amd-blade-view-body-group-item-text-not-first': '' }} {{value===item.value ? 'amd-blade-view-body-group-item-text-selected' : ''}}">
<slot item="{{item}}">{{item.label}}</slot>
</view>
</view>
Expand Down
9 changes: 5 additions & 4 deletions src/BladeView/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
font-size: 26 * @rpx;
background: #f5f5f5;

&.firstBorder {
&-first {
border-top: 1 * @rpx solid #eee;
}

&.sticky {
&-sticky {
position: sticky;
top: 0;
z-index: 99;
}
}

Expand All @@ -49,12 +50,12 @@
white-space: nowrap;
line-height: 48 * @rpx;

&.notFirstBorder {
&-not-first {
position: relative;
.hairline('top');
}

&.selected {
&-selected {
color: #3875f6;
}
}
Expand Down