本文实例为大家分享了Vue点击显示不同图片的具体代码,供大家参考,具体内容如
使用Vue中的以下知识点来显示效果
①:v-for:循环遍历数据
②:v-bind:class={ }:绑定样式
③:v-on:click(简写@click):点击事件
④:v-if:判断
<!DOCTYPE html> <html> <head> <title>点击显示相对应的图片</title> <style type="text/css"> *{ margin: 0; padding: 0; list-style: none; } .myul{ display: flex; } .myul li{ border: 1px solid orange; height: 150px; width: 150px; flex-direction: row; text-align: center; line-height: 150px; } .content{ border: 1px solid grey; height: 350px; width: 600px; } .content img{ height: 350px; width: 600px; } .active{ background: #3A9ffb; color: white; } </style> </head> <body> <div class="app"> <div class="title"> <ul class="myul"> <li v-for="(item,index) in mess" v-bind:class="{ 'active': status === index}" v-on:click="changeImg(index)"> {{item.content}} </li> </ul> </div> <div class="content"> <img src="/UploadFiles/2021-04-02/1.jpg">以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
风云阁资源网 Design By www.bgabc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
风云阁资源网 Design By www.bgabc.com
暂无评论...
更新日志
2024年09月27日
2024年09月27日
- Sweety.2006-花言乔语【丰华】【WAV+CUE】
- 李恕权.2003-回·20年全精选2CD【SONY】【WAV+CUE】
- 赞多《序章》[FLAC/分轨][129.13MB]
- 群星《完美的她 影视原声带》[320K/MP3][51.98MB]
- 群星《完美的她 影视原声带》[FLAC/分轨][141.05MB]
- 山风点伙.1997-深藏不露【立得】【WAV+CUE】
- 李幸倪.2018-First.Of.All.Live.Concert.3CD(2024环球红馆40复刻系列)【环球】【WAV+CUE】
- 李恕权.2003-回·20年全精选2CD【SONY】【WAV+CUE】
- 群星《你就在我身边 电影原声专辑》[320K/MP3][26.68MB]
- 群星《你就在我身边 电影原声专辑》[FLAC/分轨][70.27MB]
- 班得瑞原装进口《20周年精选集》1CD[APE/CUE分轨][303MB]
- 群星.2009-NOON.D.广东.2CD【新世纪】【WAV+CUE】
- 洪卓立.2012-GROWN.UP【英皇娱乐】【WAV+CUE】
- 梁静茹.2007-崇拜【相信音乐】【WAV+CUE】
- 金佩姗.1997-喜新恋旧【现代派】【WAV+CUE】