vue 背景图片 backgroundImage background-image vue的style方式绑定行内样式-background-image的方式等~

<template>
  <div id="app">
    <div class="y_bj" :style="y_bj"></div>
  </div>
</template>
<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      y_bj: {
        backgroundImage: "url(" + require("@/assets/images/user_bj.png") + ")",
        backgroundRepeat: "no-repeat",
        backgroundSize: "100%",
        width: "100%",   
      }
    };
  },
  methods: {}
};
</script>
<style lang="scss" scoped>
.y_bj {
  width: 375px;
  height: 125px;
}
</style>

如果我的内容对你有帮助,欢迎投食(dashang)。

发布了29 篇原创文章 · 获赞 24 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/lijiabinbbg/article/details/89602689