在template中放一个div,给div设置背景图
<template>
<div class="background">
</div>
</template>
给div设置css样式
<style rel="stylesheet/scss" lang="scss">
.background {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-image: url('../assets/images/login-background.png');
background-size: 100% 100%;
}
即可实现背景图适配页面变化自动放大缩小