Skip to content

Commit

Permalink
feat(Container): 无title、headerRight时隐藏header
Browse files Browse the repository at this point in the history
  • Loading branch information
wyj580231 committed Feb 8, 2023
1 parent 5e8a141 commit 97b24a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions demo/pages/Container/index.axml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<!-- 标题在容器内 -->
<container title="标题" style="margin: 20px 0;">
<container title="标题">
<view class="content">
</view>
</container>


<!-- 标题在容器外 -->

<container headerInBox="{{false}}" style="margin-bottom: 40px;">
<container headerInBox="{{false}}">
<view slot="title">
<view class="icon">
<icon type="SmileOutline" style="margin-right: 8px;" />
标题
</view>
</view>
<view slot="headerRight">右部内容</view>
<view slot="headerRight">右侧内容</view>
<view class="content">
</view>
</container>


<!-- 容器内多个盒子 -->
<container title="标题">
<view slot="headerRight">右部内容</view>
<view slot="headerRight">右侧内容</view>
<view class="content">
<view class="box">
</view>
Expand All @@ -37,10 +37,10 @@
<container>
<view class="content">
</view>
<view slot="headerRight">右部内容</view>
<view slot="headerRight">右侧内容</view>
</container>

<!-- 不含标题 -->
<!-- 不含标题、右侧内容 -->
<container>
<view class="content">
</view>
Expand Down
8 changes: 4 additions & 4 deletions src/Container/ContainerHeader/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
display: flex;
align-items: center;
height: 96 * @rpx;
justify-content: flex-end;
&:empty {
display: none;
}
}
.@{containerPrefix}-header-title:empty+.@{containerPrefix}-header-right:not(:empty){
flex: 1;
}
}

&-headerInBox {
Expand All @@ -38,9 +42,5 @@
position: relative;
.hairline('bottom');
}
.@{containerPrefix}-header-title:empty+.@{containerPrefix}-header-right:not(:empty){
flex: 1;
justify-content: flex-end;
}
}
}

0 comments on commit 97b24a2

Please sign in to comment.