1.flex左右分布
.flex{ display: flex; justify-content: space-between; flex-wrap: wrap; text-decoration: none; }
2.切换tabs
第一种 <view class="buttons"> <view class="lib btn_re" @click="pendingClick()" :class="change?'active':''">待审批 <view class="red_code"> <view class="txt">{{totalCount}}</view> </view> </view> <view class="lib" @click="finishClick()" :class="change?'':'active'">我的完成</view> </view> </view><view class="lib_tab" v-if="change">我是待审批</view> <view class="lib_tab" v-else>我是完成</view>change: true, // 切换待审批与完成pendingClick() { //待审批 var _this = this; if (_this.change == false) { _this.change = true } }, finishClick() { //完成 var _this = this; if (_this.change == true) { _this.change = false } },
或 <view class="buttons"> <view class="lib" @click="workClick()" :class="{ active: work }">工作台</view> <view class="lib btn_re" @click="pendingClick()" :class="{ active: pend }"> 待审批 <view class="red_code"> <view class="txt">{{BZDDate.processCount}}</view> </view> </view> <view class="lib" @click="finishClick()" :class="{ active: change }">我的申请</view> </view>work: true, // 工作台 pend: false, // 待审批 change: false, // 申请workClick() { //工作台 var _this = this; if (_this.work == false) { _this.work = true; _this.pend = false; _this.change = false; } },