1***@qq.com
1***@qq.com
  • 发布:2020-09-14 17:41
  • 更新:2021-06-11 18:38
  • 阅读:614

css中的三元判断的值没有实时更新

分类:HBuilderX

产品分类: HbuilderX

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win7旗舰

HBuilderX版本号: 2.8.11

示例代码:
<view class="openYSteps" @click="click_ navigation()" :class=" [trajectoryList. length>o?'op</view> <view class="openYSteps" @click="click_ navigation()" :class=" [trajectoryList. length>o?'op enYStepcolor' :trajectoryL ist. length]" <view style="width: 100%; height: 100%; ">{{trajectoryList . length}◆ <image class=" pull-up- img" :class="{'is-xun':is show trajectoryList==1}" src="'/static/jbimg/rise. png '| domainName" ></ image> </view>
</view>

操作步骤:
<view class="openYSteps" @click="click_ navigation()" :class=" [trajectoryList. length>o?'op</view> <view class="openYSteps" @click="click_ navigation()" :class=" [trajectoryList. length>o?'op enYStepcolor' :trajectoryL ist. length]" <view style="width: 100%; height: 100%; ">{{trajectoryList . length}◆ <image class=" pull-up- img" :class="{'is-xun':is show trajectoryList==1}" src="'/static/jbimg/rise. png '| domainName" ></ image> </view>
</view>

预期结果:

结果是 :class="{'openYStepcolor':trajectoryList.length!=0}" openYStepcolor这个样式要显示

实际结果:

结果是 :class="{'openYStepcolor':trajectoryList.length!=0}" openYStepcolor 这个样式没有出来

bug描述:

trajectoryList数组的长度,样式里的trajectoryList的长度没有改变
我在标签里是trajectoryList.length是8
在样式里是0

2020-09-14 17:41 负责人:无 分享
已邀请:
止水

止水

解决了吗?三元表达式里面,数组的length不会更新

该问题目前已经被锁定, 无法添加新回复