html

<div class="racetm" :style="{backgroundImage: 'url(' + (coverImgUrl ? coverImgUrl : baseImg) + ')', backgroundSize:'100% 100%', backgroundRepeat: 'no-repeat'}">

</div>

画重点

backgroundSize:'100% 100%'  背景图片大小 必须这么写 x轴 y轴 才能100覆盖
backgroundRepeat: 'no-repeat' 背景图片不重复

script  动态赋值

<script>
export default {
name: "racehome",
data(){
return{
baseImg: require('../../assets/images/other/campain_bg.jpg'),
coverImgUrl: ''
,
}
},
methods:{
_getracerule(){
getracerule({id: this.id},{'token':Cookies.get('token'),'platform': 'web'}).then((data)=>{
this.rule=data.rule;
this.coverImgUrl = data.bg_url;
})
},
}
</script>

css

    .racetm
width: 100%
height:100%;
background:#fff

vue 动态绑定背景图片的更多相关文章

  1. vue 首页背景图片加载完成前增加 loading 效果 -- 使用 new Image() 实现

    1. 创建 loading 公用组件 <template> <div class="load-container"> <div class=" ...

  2. vue css背景图片打包后路径问题

    limit,代表如果小于大约4k则会自动帮你压缩成base64编码的图片,否则拷贝文件到生产目录 name,后面是打包后的路径: loader,后面 limit 字段代表图片打包限制,这个限制并不是说 ...

  3. VUE 绑定背景图片的写法

    <div v-bind:style='{"background-image":"url("+imgUrl+")"}' >< ...

  4. vue设置背景图片

    现在data里面定义: note: { backgroundImage: "url(" + require("../../assets/home/bigdatabak.p ...

  5. vue动态绑定图片和背景图

    1.动态绑定图片 <img class="binding-img" :src="require('../assets/images/test.png')" ...

  6. vue+webpack项目打包后背景图片加载不出来问题解决

    在做VUE +的WebPack脚手架项目打包完成后,在IIS服务器上运行发现项目中的背景图片加载不出来检查项目代码发现是因为CSS文件中,背景图片引用的路径问题;后来通过修改配置文件,问题终于解决了, ...

  7. vue的图片路径,和背景图片路径打包后错误解决

    最近在研究vue,老实的按照官网提供的,搭建的了 webpack+vue+vuex+vue-router,,因为是自己搭建的,所以踩了不少坑,一般问题百度都有,这个背景图片的问题,查了很久才解决. 1 ...

  8. Vue项目开发之打包后背景图片路径错误的坑

    在开发vue项目的过程中,使用浏览器进行预览的时候所有图片的路径是没有任何问题的,但是在打包后传到服务器上,在微信端查看背景图片时,background的图片竟然不显示,img标签里的图片却是正常展示 ...

  9. vue图片、背景图片路径问题

    vue图片.背景图片路径问题 vue中引入图片经常会出现路径问题,在此记录一下: 1.组件中 <img> 引用图片 <img src="../assets/img/logo ...

随机推荐

  1. vc写的dll被mingw的g++编译引用

    dll.cpp,用vc2017编译 #include <iostream>#include <windows.h> extern "C" __declspe ...

  2. QT 获取电脑时间

    使用环境: VS2010 & QT Designer5 #include <QDateTime>  //包含头文件 QDateTime local(QDateTime::curre ...

  3. python3 日志检索异常抛出异常 raise KeyError(key),KeyError: 'formatters'

    原因分析,python3启动时,检索的不是项目包下的目录文件,所以日志文件必须指明路径.我原来的日志方式是: import logging.config log_path = "mlpcap ...

  4. day_6.26 反射

    #utf-8 #2018-6-26 17:58:36 #反射,, 应用:从类里面获取字符串 #在python中万物皆对象 class Teacher: dic = {"查看学生信息" ...

  5. 一窥Spring Cloud Eureka

    在Spring Cloud中Eureka负责服务发现功能.服务发现需要解决如何找到服务提供者在网络中位置的问题. 服务端 在Spring Tool Suite的文件菜单中,点击新建Spring Sta ...

  6. {python--GIL锁}一 介绍 二 GIL介绍 三 GIL与Lock 四 GIL与多线程 五 多线程性能测试

    python--GIL锁 GIL锁 本节目录 一 介绍 二 GIL介绍 三 GIL与Lock 四 GIL与多线程 五 多线程性能测试 一 背景知识 ''' 定义: In CPython, the gl ...

  7. POJ 1179 - Polygon - [区间DP]

    题目链接:http://poj.org/problem?id=1179 Time Limit: 1000MS Memory Limit: 10000K Description Polygon is a ...

  8. class="no-js"

    这是什么意思?看了外网的解释,比较明白了.(When Modernizr runs, it removes the "no-js" class and replaces it wi ...

  9. 转:JDK动态代理为什么必须用接口以及与CGLIB的对比

    参考链接: JDK动态代理为什么必须用接口以及与CGLIB的对比 文章中提到:试验了JDK动态代理与CGLIB动态代理.从Spring的AOP框架介绍中得知对于使用接口的类,Spring使用JDK动态 ...

  10. LeetCode 812 Largest Triangle Area 解题报告

    题目要求 You have a list of points in the plane. Return the area of the largest triangle that can be for ...