午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術文章
文章詳情頁

vue組件開發之slider組件使用詳解

瀏覽:167日期:2022-12-04 13:28:22

本文實例為大家分享了vue組件開發之slider組件的具體使用代碼,供大家參考,具體內容如下

vue組件開發之slider組件使用詳解

代碼如下:

<template> <div class='slider'> <div class='wrapbox'> <div v-for='(item, index) in items' style=''>{{item.title}}</div> </div> <div class='status'> <span v-for='(item, index) in items' v-bind:class='index == count ? ’active’ : ’’ '></span> </div> <div @click='prev()'><</div> <div @click='next()'>></div> </div></template><script> export default { name: ’slider’, data (){ return {count: 0,items:[{ name:'1', id:1, title:'我是圖1的內容'},{ name:'2', id:2, title:'我是圖2的內容'},{ name:'3', id:3, title:'我是圖3的內容'},{ name:'4', id:4, title:'我是圖4的內容'}] } }, components: { }, methods: { prev () {console.log(this.count);if(this.count > 0){ this.count--; document.querySelector('.wrapbox').style.webkitTransform = 'translateX(-' + (this.count * 400) + 'px)'; }else{ this.count = 0;} }, next () {console.log(this.count);if(this.count < 3){ this.count++; document.querySelector('.wrapbox').style.webkitTransform = 'translateX(-' + (this.count * 400) + 'px)'; }else{ this.count = 3;} } }, created () { } }</script><style scoped> *{margin:0 auto;padding:0;font-family:'微軟雅黑';} .slider{ position:relative; height:200px; width:400px; margin:50px auto; overflow:hidden; } .slider .wrapbox{ width:1600px; height:200px; transition:all 1.5s; } .slider .status{ position:absolute; top:170px; height:20px; width:400px; text-align:center; } .slider .status span{ display:inline-block; height:20px; width:20px; margin:0 10px; background:#eee; border-radius:10px; } .slider .status span.active{ background:#352929; } .slider .wrapbox .item{ float:left; height:200px; width:400px; line-height:200px; text-align:Center; color:#fff; font-size:25px; background:red; } .slider .wrapbox .item:nth-of-type(2){ background:blue; } .slider .wrapbox .item:nth-of-type(3){ background:yellow; } .slider .wrapbox .item:nth-of-type(4){ background:green; } .slider .btn{ position:absolute; top:50%; height:40px; width:20px; line-height:40px; color:#fff; text-align:center; background:rgba(10, 10, 10, .85); transform:translateY(-50%); cursor:pointer; } .slider .next-btn{ right:0; }</style>

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Vue
相關文章:
主站蜘蛛池模板: 免费视频一二三区 | 日本女人高潮视频 | 香蕉视频2020| 国产精品自拍第一页 | 国产69精品久久久久久 | 超碰一区二区三区 | 欧美日韩在线视频免费 | 欧美日韩高清一区二区 | 特级黄色录像 | 日韩成人综合 | 久久久777| 亚洲一区二区三区在线免费观看 | 久久国产福利 | 国产一区二区高清视频 | 永久免费在线视频 | 国产专区一区 | 欧美一级大片在线观看 | 超碰123| 欧美在线播放 | 草草视频在线观看 | 五月婷婷色播 | 久久久小视频 | 国产成人自拍在线 | 国产成人小视频 | 国产天堂在线观看 | 九九视频网 | 久久婷婷网 | 最新国产中文字幕 | 成人综合在线视频 | 欧美性猛交xxxx | 日韩精品乱码久久久久久 | av三级| 亚洲成肉网 | 青草av在线 | 花房姑娘第四季在线观看免费 | 国产高清精品在线 | 亚洲精品视频在线播放 | 黄色片亚洲 | 国产精品成人国产乱一区 | 欧美日韩一区在线 | 91精品国产一区 |