<template>
<div class="demo-style">
如果是背景图片的话,背景找一个相似的颜色,可以看起来不那么单调,不然白色一片
<!-- 这里使用v-if 就不会触发 -->
<div class="div" :style="{ backgroundImage: `url(${src1})` }">123</div>
</div>
</template>
<script>
export default {
data() {
return {
src1: require("../assets/pc-img/banner2.png"),
};
},
mounted() {},
methods: {},
};
</script>
<style lang="scss" scoped>
.demo-style {
.div {
border: 1px solid red;
width: 100%;
height: calc(100vh - 0px);
background-repeat: no-repeat;
background-size: 100%;
background-color: aquamarine;
}
}
</style>
背景原生图片加载慢,使用替代背景
最新推荐文章于 2023-11-11 10:55:07 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)