类似于微信小程序或uniapp项目,背景图片需网络路径或base64才可展示,甚是麻烦。
以下是我的解决方案:
data() {
return {
tel: '',
password: '',
img:'/static/img/banner_one.png'//展示的图片本地路径
}
},
<view class="content" :style='"background:url(" + img + ") no-repeat;background-size: 750rpx 100vh;"'></view>
这样就可以展示出背景图了。