vue项目 背景图 属性双向绑定data里数据的方法

<div class="note"   :style ="note"></div>



export default {
    data() {
        return {
        // 这里做法是直接双向绑定整个style,当然你想只双向绑定src属性也是一样的做法
            note: {
									//这里要这样写
            backgroundImage: "url(" + require("../../assets/save.png") + ")",
            
            backgroundRepeat: "no-repeat",
            backgroundSize: "25px auto",
            marginTop: "5px",
          },
     }
 },
发布了37 篇原创文章 · 获赞 20 · 访问量 6738

猜你喜欢

转载自blog.csdn.net/qq_39051175/article/details/100701296