我开发自定一扫一扫功能的时候遇到这样一个问题,在这里记录一下。
cream 中使用cover-image时如果src用的是矢量图(svg格式的话)运行到真机就会看不到图片。
在网上找了半天说是将cover-image的样式设置visibility: visible !important;运行之后还是没有效果。
后来我将图片格式换位png就完美解决了这个问题
<camera mode="scanCode" resolution="high" :flash="flash" @scancode="success" style="width: 100%; height: 70vh;">
<cover-view class="line"></cover-view>
<cover-image src="/static/border-scan.png" style="width: 90%;height: 90%;margin: 5% 5%;"></cover-image>
<cover-image @click="openlamp" class="img" src="/static/off.png" v-if="flash=='off'"></cover-image>
<cover-image @click="openlamp" class="img" src="/static/open.png" v-else></cover-image>
</camera>