下边的带啊吗是我在谷歌浏览器的console上边执行的,结果为true;
var img='1231241431.jpeg'
img != null && img != '' &&!img.endsWith('mp3')&&!img.endsWith('mp4')
true
下边的代码为项目中被异常打包的代码块
<view v-if="img != null && img != '' && !img.endsWith('mp3') && !img.endsWith('mp4')" :style="{backgroundImage: imgUrl(img) }"
@click="clickImage(img)" style="height: 340upx;width: 680upx;margin: 0 auto;background: rgba(255, 255, 255, 0.2) center no-repeat;background-size: 100% 100%;overflow: hidden;border-radius: 8upx;">
<view class="between" style="height:70upx;background: rgba(0, 0, 0, 0.2)">
<view style="margin-left: 28upx;font-size: 28upx;line-height: 40upx;">{{ taskName }}</view>
<view style="display: flex;flex-direction: row;align-items: center;">
<image src="../../../../static/score16X16.png" style="width: 32upx;height: 32upx;"></image>
<view style="font-size: 24upx;line-height: 40upx;margin: 0 32upx 0 10upx;">{{ score }}</view>
</view>
</view>
</view>
--------------------------------------------------------------具体打包错误的地方的代码如下
v-if="img != null && img != '' && !img.endsWith('mp3') && !img.endsWith('mp4')" 这段代码打包错误,img是一个url图片地址字符串,这个判断条件在谷歌浏览器和微信小程序上均是true,经hbuilder打包之后就莫名其妙的失效了,我们的项目页面中又很多复杂的v-if判断,所以这次的发布到线上的产品出现了严重的后果,因为我们这次就改了一些文案修改和简单的逻辑,所以才发布到线上的,没想到造成了严重的后果;
3 个回复
l***@163.com (作者)
更新最新的hbuilder的小伙伴打包项目的时候要注意了
DCloud_UNI_GSQ
排查中,可以先将这部分放到computed中试试
DCloud_UNI_GSQ
问题确认,已加分,后续修复。
HBuilderX alpha 3.4.8 已修复
3.4.7 版本临时解决方案,执行 npx patch-hbuilderx-plugins 修复
l***@163.com (作者)
好的
2022-04-27 14:16