vue+js點(diǎn)擊箭頭實(shí)現(xiàn)圖片切換
本文實(shí)例為大家分享了vue+js點(diǎn)擊箭頭實(shí)現(xiàn)圖片切換的具體代碼,供大家參考,具體內(nèi)容如下
前端需求是 返回的圖片數(shù)據(jù)能夠點(diǎn)擊箭頭切換
代碼如下
<div class='pubuItemsBox'><!-- 修改部分5.23晚 --><template v-for='(orderEvent, index) in orderEventList' > <div :class='{’pubuItem’:true, ’noMag’:(index+1)%3 == 0}'> <div class='imgDivs'> <template v-if='orderEvent.eventFocuspic.split(’,’).length > 1'><ins @click=’change(index,'prev')’></ins><ins @click=’change(index,'next')’></ins> </template> <ul class='ulZpImg'><template v-for='(imgUrl,imgUrlIndex) in orderEvent.eventFocuspic.split(’,’)' > <li v-show=’imgUrlIndex===orderEvent.mark’><img :src='http://www.cgvv.com.cn/bcjs/getImageUrl(showImg(imgUrl))'></li></template> </ul> </div> <div class='txtBox'> <span>{{orderEvent.brandName}}</span><ins>檔期:{{orderEvent.beginDate}}至{{orderEvent.endDate}}</ins> </div> <p style='-webkit-box-orient: vertical;'>{{orderEvent.eventDesc}}</p> </div></template> </div> <script>change(i, type){var obj = this.orderEventList[i];var imgLength =obj.eventFocuspic.split(’,’).length;if (type === 'prev') { if (obj.mark == 0) { obj.mark = imgLength - 1 return } obj.mark--;}if (type === 'next') { if (obj.mark == imgLength - 1) { obj.mark = 0 return } console.log(obj.mark) obj.mark++;} }</script>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 微信小程序?qū)崿F(xiàn)商品分類頁(yè)過(guò)程結(jié)束2. .NET 中配置從xml轉(zhuǎn)向json方法示例詳解3. 基于Surprise協(xié)同過(guò)濾實(shí)現(xiàn)短視頻推薦方法示例4. 不使用XMLHttpRequest對(duì)象實(shí)現(xiàn)Ajax效果的方法小結(jié)5. 以PHP代碼為實(shí)例詳解RabbitMQ消息隊(duì)列中間件的6種模式6. 推薦一個(gè)好看Table表格的css樣式代碼詳解7. ASP新手必備的基礎(chǔ)知識(shí)8. ASP常用日期格式化函數(shù) FormatDate()9. vue-electron中修改表格內(nèi)容并修改樣式10. AJAX實(shí)現(xiàn)文件上傳功能報(bào)錯(cuò)Current request is not a multipart request詳解
