hidden属性失效?
我今天开发时碰到一个问题,就是如果我给父组件设置了高度的话,那么hidden属性就不会生效,截图如下:
wxml
<!-- 搜索框 -->
<view class="search">
<view class="search_row">
<input bindinput="handleInput" placeholder="请输入您要搜索的商品"></input>
<!-- 隐藏的搜索框 带取消 开始 -->
<view bindtap="handleCancel" hidden="{{!inputing}}">取消</view>
<!-- 隐藏的搜索框 带取消 结束 -->
<view hidden="{{true ? true : false}}"> Hidden </view>
</view>
</view>
css
.search {
height: 100vh;
background-color: #dedede;
}
.search .search_row {
padding: 10rpx;
height: 50rpx;
width: 100%;
display: flex;
}
.search .search_row input {
flex: 1;
background-color: white;
padding-left: 30rpx;
border-radius: 5rpx;
height: 50rpx;
margin: 0 auto;
}
.search .search_row view {
height: 50rpx;
width: 100rpx;
font-size: 26rpx;
margin-left: 30rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #f8f8f8;
border-radius: 5rpx;
}