要实现的效果:
wxml端代码:
<view class="prepare_param">
<view class="prepare_confirm1">
<button size="mini" type="primary" bindtap="deleteById" data-id="{{item.id}}">作废</button>
</view>
<navigator class="prepare_confirm2" url="/pages/prepare_addAndEdit/index?prepare_id={{item.id}}&supplyId={{item.supplyId}}">
<button size="mini" type="primary">修改</button>
</navigator>
</view>
样式代码
.prepare_param { .prepare_confirm1{ padding-left: 350rpx; } .prepare_confirm2{ 150rpx; float: right; } }
分析:
将一个div分成两部分,将右侧的按钮的宽度设置成略大于按钮本身的宽度,并让整个div移动到最右端。剩余的宽度为左侧按钮所在div的总宽度,此时设置padding-left的宽度,实现
让左侧按钮无限接近右侧按钮