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%",
         "100%",   
      }
    };
  },
  methods: {}
};
</script>
<style lang="scss" scoped>
.y_bj {
   375px;
  height: 125px;
}
</style>

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

原文地址:https://www.cnblogs.com/sexintercourse/p/12488525.html