vue动态改变背景图片demo分享

前端之家收集整理的这篇文章主要介绍了vue动态改变背景图片demo分享前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

如下所示:

<Meta charset="UTF-8"> @H_<a href="https://www.jb51.cc/tag/502/" target="_blank" class="keywords">502</a>_8@ <script type="text/javascript" src="js/vue.js" ></script> <style> #bag{ width: 200px; height: 500px; margin: 0 auto; background: url(img/piao11.jpg) center no-repeat; background-size: 80%; } .burst{ background-image: url(img/piao12.jpg) !important; background-size: 80%; } <h1>bag-health{</h1> <p>width: 200px;<br /> border: 2px solid #000000;<br /> margin: 0 auto 20px auto;<br /> }</p> <h1>bag-health div{</h1> <p>height: 20px;<br /> background: crimson;<br /> }</p> <h1>controls{</h1> <p>width: 200px;<br /> margin: 0 auto;<br /> } </p> <h1>controls button{</h1> <p>margin-left: 23px;<br /> }</p> </style> </head> <body> <div id="app"> <!--当前图片--> <div id="bag" :class='{burst:ended}'></div> <!--进度情况--> <p><div id="bag-health"><br /> <div :style="{width:health + '%'}"></div></p> </div> <!--控制按钮--> <p><div id="controls"><br /> <button @click='punch' v-show='!ended'>使劲敲</button></p> <p><button @click='restart'>重新开始</button></p> </div> </div> <script> new Vue({ el:"#app",data:{ health:100,ended:false },methods:{ punch:function(){ this.health -= 10; <p>if (this.health<=0) {<br /> this.ended = true</p> <p>}<br /> },restart:function(){<br /> this.health = 100;<br /> this.ended = false<br /> }<br /> },computed:{</p> <p>}<br /> })</p> </script> </body> </html></pre> </div> <p>以上这篇vue动态改变背景<a href="https://www.jb51.cc/tag/tupian/" target="_blank" class="keywords">图片</a>demo<a href="https://www.jb51.cc/tag/fenxiang/" target="_blank" class="keywords">分享</a>就是小编<a href="https://www.jb51.cc/tag/fenxiang/" target="_blank" class="keywords">分享</a>给大家的全部<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>了,希望能给大家一个参考,也希望大家多多<a href="https://www.jb51.cc/tag/zhichi/" target="_blank" class="keywords">支持</a>编程之家。</p><i class="glyphicon glyphicon-link"></i> 原文链接:https://www.f2er.com/vue/30245.html</div> <div class="topcard-tags"><a href="https://www.f2er.com/tag/vue/" class="tag_link" target="_blank">vue</a><a href="https://www.f2er.com/tag/pvue/" class="tag_link" target="_blank">vue</a><a href="https://www.f2er.com/tag/vuep/" class="tag_link" target="_blank">vue</a><a href="https://www.f2er.com/tag/beijingtupian/" class="tag_link" target="_blank">背景图片</a></div> <ul class="list-group"> <li class="list-group-item"><a href="https://www.f2er.com/vue/30246.html" title="vue vue-Router默认hash模式修改为history需要做的修改详解">上一篇:vue vue-Router默认hash模式修改为</a><a href="https://www.f2er.com/vue/30243.html" title="Vue点击切换颜色的方法" class="text-muted pull-right">下一篇:Vue点击切换颜色的方法</a> </li> </ul> </div> </div> </div> <!-- row end --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-4605373693034661" data-ad-slot="9144498553"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script></div> </div> </div> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <div class="title"><h1>猜你在找的Vue相关文章</h1></div> <div class="list_con"> <a href="https://www.f2er.com/vue/997429.html" title="elementui的el-tree第一次加载无法展开和选中的问题"><div class="title">elementui的el-tree第一次加载无法展开和选中的问题</div> <div class="summary">问题现象 elmentui的el-tree数据加载问题,导致第一次加载选中当前节点和高亮当前节点没有...</div> <time class="summary">作者:前端之家 时间:2021-02-17</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/vue/997428.html" title="VSCODE打开一个文件,另一个文件就关闭的问题的解决方法"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/02-17/21/9e2e32f4ad7f00fdffa540c0f7d918e1.png" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">VSCODE打开一个文件,另一个文件就关闭的问题的解决方法</div> <div class="summary">因为刚打开文件,vscode默认是预览状态,如果编辑过之后,就不会有这个问题。 可以通过双击...</div> <time class="summary">作者:前端之家 时间:2021-02-17</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/vue/997427.html" title="一文带你学会国产加密算法SM4的vue实现方案"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/02-17/21/29a0275a80b1fac147aa687624a9bfe1.png" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">一文带你学会国产加密算法SM4的vue实现方案</div> <div class="summary">前言 上篇文章我们介绍了国产SM4加密算法的后端java实现方案。没有看过的小伙伴可以看一下...</div> <time class="summary">作者:前端之家 时间:2021-02-17</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/vue/997426.html" title="解决vue报错:Module build failed (from ./node_modules/_eslint-loader@2.2.1@eslint-loader/index.js): TypeError: Cannot read property 'range' of null"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/02-17/21/ac433ae643be89ef37b127b24fa2a61a.png" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">解决vue报错:Module build failed (from ./node_modules/_eslint-loader@2.2.1@eslint-loader/index.js): TypeError: Cannot read property 'range' of null</div> <div class="summary">在项目中引入动态路由时报错 写法: 报错: Module build failed (from ./node_modules/_esl...</div> <time class="summary">作者:前端之家 时间:2021-02-17</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/vue/997425.html" title="vue中解决Uncaught ReferenceError: regeneratorRuntime is not defined问题"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/02-17/21/9f2045768979b899c69e66354a1f62d0.png" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">vue中解决Uncaught ReferenceError: regeneratorRuntime is not defined问题</div> <div class="summary">问题产生 在使用babel编译es6时,遇到报错Uncaught ReferenceError: regeneratorRuntime i...</div> <time class="summary">作者:前端之家 时间:2021-02-17</time> </a> </div> <div style="border-bottom: 1px solid #f4f4f4;margin-top:20px;"> <ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-fr-2o+fp-dx-wx" data-ad-client="ca-pub-4605373693034661" data-ad-slot="4561116489"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div><div class="list_con"> <a href="https://www.f2er.com/vue/997423.html" title="element-UI中手动调用table排序"><div class="title">element-UI中手动调用table排序</div> <div class="summary">&amp;lt;el-table :data=&amp;quot;tableData&amp;quot; &amp;quot;width...</div> <time class="summary">作者:前端之家 时间:2021-02-17</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/vue/994895.html" title="Vue双向绑定原理及其实现"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/01-10/13/13055abb3c90b13ed50222b980d4a858.gif" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">Vue双向绑定原理及其实现</div> <div class="summary">在之前面试的时候被面试官问到是否了解Vue双向绑定的原理,其实自己之前看过双向绑定的原理...</div> <time class="summary">作者:前端之家 时间:2021-01-10</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/vue/994894.html" title="Vue事件修饰符详解"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/01-10/13/b4cf1534468c90981806f6f883c8e876.png" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">Vue事件修饰符详解</div> <div class="summary">整体学习Vue时看到Vue文档中有事件修饰符的描述,但是看了之后并没有理解是什么意思,于是...</div> <time class="summary">作者:前端之家 时间:2021-01-10</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/vue/994741.html" title="Vue-router插件使用"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/01-01/21/bf84b4bbaaac53ea67ceec4898781512.png" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">Vue-router插件使用</div> <div class="summary">单页面原理 Vue是单页面开发,即页面不刷新。 页面不刷新,而又要根据用户选择完成内容的更...</div> <time class="summary">作者:前端之家 时间:2021-01-01</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/vue/994740.html" title="Vue 分支循环"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/01-01/21/ed0d5c51fe9891d0c42f795f23333ec1.png" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">Vue 分支循环</div> <div class="summary">v-for 通过v-for进行循环,不光可以拿到元素本身,也可以拿到索引值。 如果数据是对象类型...</div> <time class="summary">作者:前端之家 时间:2021-01-01</time> </a> </div> <div style="border-bottom: 1px solid #f4f4f4;margin-top:20px;"> <ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-fr-2o+fp-dx-wx" data-ad-client="ca-pub-4605373693034661" data-ad-slot="4561116489"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div></div> </div> </div> </div> <!-- left end--> <!-- right --> <div class="col-sm-12 col-md-12 col-lg-3"> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <label class="main-content-label ">编程分类</label> <div class="cate mt-20"><a href="https://www.f2er.com/html/" title="HTML">HTML</a><a href="https://www.f2er.com/html5/" title="HTML5">HTML5</a><a href="https://www.f2er.com/js/" title="JavaScript">JavaScript</a><a href="https://www.f2er.com/css/" title="CSS">CSS</a><a href="https://www.f2er.com/jquery/" title="jQuery">jQuery</a><a href="https://www.f2er.com/bootstrap/" title="Bootstrap">Bootstrap</a><a href="https://www.f2er.com/angularjs/" title="Angularjs">Angularjs</a><a href="https://www.f2er.com/typescript/" title="TypeScript">TypeScript</a><a href="https://www.f2er.com/vue/" title="Vue">Vue</a><a href="https://www.f2er.com/dojo/" title="Dojo">Dojo</a><a href="https://www.f2er.com/json/" title="Json">Json</a><a href="https://www.f2er.com/electron/" title="Electron">Electron</a><a href="https://www.f2er.com/nodejs/" title="Node.js">Node.js</a><a href="https://www.f2er.com/extjs/" title="extjs">extjs</a><a href="https://www.f2er.com/express/" title="Express ">Express </a><a href="https://www.f2er.com/xml/" title="XML">XML</a><a href="https://www.f2er.com/es6/" title="ES6">ES6</a><a href="https://www.f2er.com/ajax/" title="Ajax">Ajax</a><a href="https://www.f2er.com/flash/" title="Flash">Flash</a><a href="https://www.f2er.com/unity/" title="Unity">Unity</a><a href="https://www.f2er.com/react/" title="React">React</a><a href="https://www.f2er.com/flex/" title="Flex">Flex</a><a href="https://www.f2er.com/antdesign/" title="Ant Design">Ant Design</a><a href="https://www.f2er.com/webfrontend/" title="Web前端">Web前端</a><a href="https://www.f2er.com/weapp/" title="微信小程序">微信小程序</a><a href="https://www.f2er.com/wxmp/" title="微信公众号">微信公众号</a><div class="clearfix"></div> </div> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <!-- f2er-rightads --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4605373693034661" data-ad-slot="7756441254" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <label class="main-content-label ">最新文章</label> <ul class="n-list"><li><a href="https://www.f2er.com/vue/997429.html" title="elementui的el-tree第一次加载无法展开和选中的问题" target="_blank">• elementui的el-tree第一次</a></li> <li><a href="https://www.f2er.com/vue/997428.html" title="VSCODE打开一个文件,另一个文件就关闭的问题的解决方法" target="_blank">• VSCODE打开一个文件,另一</a></li> <li><a href="https://www.f2er.com/vue/997427.html" title="一文带你学会国产加密算法SM4的vue实现方案" target="_blank">• 一文带你学会国产加密算法</a></li> <li><a href="https://www.f2er.com/vue/997426.html" title="解决vue报错:Module build failed (from ./node_modules/_eslint-loader@2.2.1@eslint-loader/index.js): TypeError: Cannot read property 'range' of null" target="_blank">• 解决vue报错:Module buil</a></li> <li><a href="https://www.f2er.com/vue/997425.html" title="vue中解决Uncaught ReferenceError: regeneratorRuntime is not defined问题" target="_blank">• vue中解决Uncaught Refere</a></li> <li><a href="https://www.f2er.com/vue/997424.html" title="vue的自定义组件如何使用prop传值?" target="_blank">• vue的自定义组件如何使用p</a></li> <li><a href="https://www.f2er.com/vue/997423.html" title="element-UI中手动调用table排序" target="_blank">• element-UI中手动调用tabl</a></li> <li><a href="https://www.f2er.com/vue/994895.html" title="Vue双向绑定原理及其实现" target="_blank">• Vue双向绑定原理及其实现</a></li> <li><a href="https://www.f2er.com/vue/994894.html" title="Vue事件修饰符详解" target="_blank">• Vue事件修饰符详解</a></li> <li><a href="https://www.f2er.com/vue/994741.html" title="Vue-router插件使用" target="_blank">• Vue-router插件使用</a></li> </ul> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <label class="main-content-label ">热门标签 <span class="pull-right tx-12"> <a href="https://www.f2er.com/all" target="_blank">更多 ►</a></span> </label> <div class="topcard-tags"><a href="https://www.f2er.com/tag/guanbiyangao/" title="关闭广告" target="_blank">关闭广告</a><a href="https://www.f2er.com/tag/danduheaders/" title="单独headers" target="_blank">单独headers</a><a href="https://www.f2er.com/tag/fengzhuangdaima/" title="封装代码" target="_blank">封装代码</a><a href="https://www.f2er.com/tag/tishicuowu/" title="提示错误" target="_blank">提示错误</a><a href="https://www.f2er.com/tag/zhengshuzhengze/" title="整数正则" target="_blank">整数正则</a><a href="https://www.f2er.com/tag/fei0kaitou/" title="非0开头" target="_blank">非0开头</a><a href="https://www.f2er.com/tag/tiaoye/" title="跳页" target="_blank">跳页</a><a href="https://www.f2er.com/tag/chuyema/" title="出页码" target="_blank">出页码</a><a href="https://www.f2er.com/tag/antdtable/" title="antd table" target="_blank">antd table</a><a href="https://www.f2er.com/tag/tishiURLweizhuce/" title="提示URL未注册" target="_blank">提示URL未注册</a><a href="https://www.f2er.com/tag/gongzhonghaozhifu/" title="公众号支付" target="_blank">公众号支付</a><a href="https://www.f2er.com/tag/vuehashmoshi/" title="vue hash模式" target="_blank">vue hash模式</a><a href="https://www.f2er.com/tag/iSlider/" title="iSlider" target="_blank">iSlider</a><a href="https://www.f2er.com/tag/chepaijianpan/" title="车牌键盘" target="_blank">车牌键盘</a><a href="https://www.f2er.com/tag/xunhuantupian/" title="循环图片" target="_blank">循环图片</a><a href="https://www.f2er.com/tag/echartsshuangzhexian/" title="echarts 双折线" target="_blank">echarts 双折</a><a href="https://www.f2er.com/tag/zuoyoubuju/" title="左右布局" target="_blank">左右布局</a><a href="https://www.f2er.com/tag/DllPlugin/" title="DllPlugin" target="_blank">DllPlugin</a><a href="https://www.f2er.com/tag/duixiangchuangjian/" title="对象创建" target="_blank">对象创建</a><a href="https://www.f2er.com/tag/daziyouxi/" title="打字游戏" target="_blank">打字游戏</a><a href="https://www.f2er.com/tag/quanxuan/" title="圈选" target="_blank">圈选</a><a href="https://www.f2er.com/tag/lianglan/" title="两栏" target="_blank">两栏</a><a href="https://www.f2er.com/tag/yunhanshu/" title="云函数" target="_blank">云函数</a><a href="https://www.f2er.com/tag/mengban/" title="蒙版" target="_blank">蒙版</a><a href="https://www.f2er.com/tag/ES2020/" title="ES2020" target="_blank">ES2020</a><a href="https://www.f2er.com/tag/chuchuang/" title="橱窗" target="_blank">橱窗</a><a href="https://www.f2er.com/tag/wufenggundonglunbo/" title="无缝滚动轮播" target="_blank">无缝滚动轮播</a><a href="https://www.f2er.com/tag/sekuaipengzhuang/" title="色块碰撞" target="_blank">色块碰撞</a><a href="https://www.f2er.com/tag/zujianxiaohui/" title="组件销毁" target="_blank">组件销毁</a><a href="https://www.f2er.com/tag/wendangcaozuo/" title="文档操作" target="_blank">文档操作</a></div> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <!-- f2er-rightads --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4605373693034661" data-ad-slot="7756441254" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> <!-- row end --> </div> <!-- right end --> </div> </div> <footer id="footer"> <div class="container"> <div class="row hidden-xs"> <dl class="col-sm-6 site-link"> <dt>最近更新</dt><dd><a href="https://www.f2er.com/win11/1005878.html" title="【联想一体机系统重装指南】" target="_blank">· 【联想一体机系统重装指南】</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005877.html" title="笔记本系统重装教程:轻松解决系统问题" target="_blank">· 笔记本系统重装教程:轻松解决系统问题</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005876.html" title="重装系统:U盘启动,轻松搞定!" target="_blank">· 重装系统:U盘启动,轻松搞定!</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005875.html" title="大白菜u盘重装系统,让你的电脑焕然一新!" target="_blank">· 大白菜u盘重装系统,让你的电脑焕然一新!</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005874.html" title="U盘重装系统:轻松启动,快速恢复" target="_blank">· U盘重装系统:轻松启动,快速恢复</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005873.html" title="重装电脑系统的步骤及注意事项" target="_blank">· 重装电脑系统的步骤及注意事项</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005872.html" title="深度重装系统,一键解决电脑问题" target="_blank">· 深度重装系统,一键解决电脑问题</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005871.html" title="重装系统的正确操作步骤,让你的电脑焕然一新" target="_blank">· 重装系统的正确操作步骤,让你的电脑焕然一新</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005870.html" title="安全模式重装系统:保障您设备安全的最佳选择" target="_blank">· 安全模式重装系统:保障您设备安全的最佳选择</a><span class="text-muted pull-right">10-03</span></dd> <dd><a href="https://www.f2er.com/win11/1005869.html" title="戴尔重装系统步骤大全" target="_blank">· 戴尔重装系统步骤大全</a><span class="text-muted pull-right">10-03</span></dd> </dl> <dl class="col-sm-4 site-link"> <dt>好站推荐</dt><dd> <a href="https://www.runoob.com" title="菜鸟教程(www.runoob.com)提供了编程的基础技术教程, 介绍了HTML、CSS、Javascript、Python,Java,Ruby,C,PHP , MySQL等各种编程语言的基础知识。 同时本站中也提供了大量的在线实例,通过实例,您可以更好的学习编程。" target="_blank">菜鸟教程</a></dd><dd> <a href="https://www.jb51.cc" title="编程之家(www.jb51.cc)是成立于2017年面向全球中文开发者的技术内容分享平台。提供编程导航、编程问答、编程博文、编程百科、编程教程、编程工具、编程实例等开发者最需要的编程技术内容与开发工具支持,与你一起学习编程,相信编程改变未来!" target="_blank">编程之家</a></dd><dd> <a href="https://www.f2er.com" title="前端之家 f2er.com 前端开发人员所需学习知识手册。" target="_blank">前端之家</a></dd></dl> <dl class="col-sm-2 site-link"> <dt>商务合作</dt> <dd><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=76874919&site=qq&menu=yes">联系我们</a></dd> </dl> </div> <div class="copyright"> Copyright © 2019 前端之家. 当前版本 V7.0.16<br> <span class="ml5">前端之家 版权所有 <a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">闽ICP备13020303号-10</a></span> </div> </div> </footer> <script type="text/javascript" src="https://www.f2er.com/js/base.js"></script> </body> </html>