background: no-repeat center top / 100% 100%;
background-image: linear-gradient(
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 1)
),
url('https://cup-storage.oss-cn-hangzhou.aliyuncs.com/202101071252428656.jpg');
实际vue项目中使用:
:style="{
background: 'no-repeat center top / 100%',
backgroundImage:
'linear-gradient(rgba(255, 255, 255, 0),rgba(255, 255, 255, 1)),url(' +
'\'' +
$route.query.brandLogo +
'\'' +
')',
}"
补充:backgroundSize为cover时图片显示不完整的问题
'cover'改成'100% 100%'