小程序中display:flex和v-show,v-show不生效,uni-app

博客指出在小程序里,使用display:flex和v-show时v-show不生效。原因是display:flex样式优先级高于v-show(v-show本质是display:none)。解决方案是使用:style=\判断对象?‘’:‘display:none;’\。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

小程序中display:flex和v-show,v-show不生效、、

解决方案:
display:flex样式的优先级高于了v-show ,v-show其实就是display:none,display:flex优先级高于display:none。

使用

:style=“判断对象?‘’:‘display:none;’”

在这里插入图片描述

``` <template> <view class="find-container "> <view class="head"> <view class="tab-list2"> <view @tap="changeTab(1,1)" :class="['tab-item2','',activeTab1==1?'active':'']"> <text>待打印</text> </view> <!-- #ifdef MP-WEIXIN --> <view @tap="changeTab(2,1)" :class="['tab-item2','',activeTab1==2?'active':'']"> <text>已打印</text> </view> <!-- #endif --> <view @click="showDrawer('showRight')" :class="['tab-item2']" > <image class="icon" mode="aspectFit" src="@/static/image/search-icon.png"></image> </view> </view> <view class="tab-list " > <view v-for="(item,index) in order_status" @tap="changeTab(1,index)" :class="['tab-item','',activeTab2==index?'active':'']"> <uni-badge class="uni-badge-left-margin" max-num="99999" :is-dot="item.activeTabJiNum==0" :text="item.activeTabJiNum" absolute="rightTop" :offset="[-6, -3]" size="small" v-if="activeTab2==index"><text>{{item.text}}</text></uni-badge> <text v-else>{{item.text}}</text> </view> </view> <view class="tab-list " v-if="activeTab1==2"> <view v-for="(item,index) in team_status" @tap="changeTab(2,index)" :class="['tab-item','',activeTab2==index?'active':'']"> <uni-badge class="uni-badge-left-margin" max-num="99999" :is-dot="item.activeTabJiNum==0" :text="item.activeTabJiNum" absolute="rightTop" :offset="[-6, -3]" size="small" v-if="activeTab2==index"><text>{{item.text}}</text></uni-badge> <text v-else>{{item.text}}</text> </view> </view> </view> <view style="height: 100vh;background-color: rgb(243, 246, 249);flex: 1;z-index: 9999;"> <view style="flex: 1;z-index: 9999;display: flex;">5555</view> </view> <view class="fixed-bottom"> <view style="display: flex;margin-left: 50rpx;float: left;margin-top: 20rpx;font-weight: bold;">打印机:</view> <view style="display: flex;float: right;margin-top: 20rpx;font-weight: bold;padding-right: 10rpx;">无打印机,去连接 ></view> <view style="margin-top: 100rpx;display: flex;margin-left: 70rpx;color: gainsboro;"> <checkbox-group> <label class="checkbox"> <checkbox :value="checked" :checked="checked" /> 全选 </label> </checkbox-group> </view> <view style="display: flex;margin-left: 340rpx;margin-top: -60rpx;"> <view class="btn">立即打印</view> </view> </view> <uni-calendar ref="calendar" class="uni-calendar--hook" :clear-date="true" :date="info.date" :insert="false" :lunar="true" :range="true" @confirm="confirm" @close="calendarClose" /> <uni-drawer ref="showRight" mode="right" :mask-click="true" width="300" @change="drchange($event,'showRight')"> <view class="scroll-view"> <scroll-view class="scroll-view-box" scroll-y="true"> <view class="info"> <input class="ipt"placeholder="订单号/快递单号/手机号/寄件人/收件人" placeholderStyle="font-size: 24rpx;" type="text" v-model="mailNo"></input> </view> <view class="close"> <button type="primary" @click="closeDrawer('showRight')"><text class="word-btn-white">搜索</text></button> </view> </scroll-view> </view> </uni-drawer> </view> </template>```<view style="flex: 1;z-index: 9999;display: flex;">5555</view>这个5555不显示出来
03-27
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值