Skip to content

Commit

Permalink
优化 向左滑动出现按钮 Tencent#559
Browse files Browse the repository at this point in the history
  • Loading branch information
bearyan committed Apr 18, 2017
1 parent d037988 commit bdebbc3
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/example/fragment/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,21 @@ <h1 class="page__title">List</h1>
</div>
<div class="weui-cell__ft">说明文字</div>
</div>
<div class="weui-cell weui-cell_swiped">
<div class="weui-cell__bd" style="transform: translateX(-68px)">
<div class="weui-cell">
<div class="weui-cell__bd">
<p>标题文字</p>
</div>
<div class="weui-cell__ft">说明文字</div>
</div>
</div>
<div class="weui-cell__ft">
<a class="weui-swiped-btn weui-swiped-btn_warn" href="javascript:">删除</a>
</div>
</div>
</div>

<div class="weui-cells__title">带图标、说明的列表项</div>
<div class="weui-cells">
<div class="weui-cell">
Expand Down
1 change: 1 addition & 0 deletions src/style/weui.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

// cell
@import "./widget/weui-cell/weui-cell_global";
@import "./widget/weui-cell/weui-cell_swiped";

@import "./widget/weui-cell/weui-access";
@import "./widget/weui-cell/weui-check";
Expand Down
10 changes: 10 additions & 0 deletions src/style/widget/weui-cell/weui-cell_global.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
@import "../../base/fn";

/*
z-index:
0: .weui-swiped-btn
1: .weui-cell_swiped .weui-cell__bd
2: .weui-cells和.weui-cell的1px线
*/

.weui-cells {
margin-top: @weuiCellsMarginTop;
background-color: @weuiCellBg;
Expand All @@ -12,9 +19,11 @@
position: relative;
&:before {
.setTopLine(@weuiCellBorderColor);
z-index: 2;
}
&:after {
.setBottomLine(@weuiCellBorderColor);
z-index: 2;
}
}

Expand Down Expand Up @@ -47,6 +56,7 @@
&:before {
.setTopLine(@weuiCellBorderColor);
left: @weuiCellGapH;
z-index: 2;
}
&:first-child {
&:before {
Expand Down
31 changes: 31 additions & 0 deletions src/style/widget/weui-cell/weui-cell_swiped.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@import "../../base/fn";

.weui-cell_swiped {
display: block;
padding: 0;
> .weui-cell__bd {
position: relative;
z-index: 1;
background-color: #FFFFFF;
}
> .weui-cell__ft {
position: absolute;
right: 0;
top: 0;
bottom: 0;
display: flex;
color: #FFFFFF;
}
}
.weui-swiped-btn {
display: block;
padding: @weuiCellGapV 1em;
line-height: @weuiCellLineHeight;
color: inherit;
}
.weui-swiped-btn_default {
background-color: #C7C7CC;
}
.weui-swiped-btn_warn {
background-color: #FF3B30;
}

0 comments on commit bdebbc3

Please sign in to comment.