国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

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

Vue實現無縫輪播效果

瀏覽:7日期:2022-09-30 17:22:51

本文實例為大家分享了Vue實現無縫輪播效果的具體代碼,供大家參考,具體內容如下

代碼

1.子組件代碼

代碼如下(示例):

<template> <div> <div @mouseenter='mouse' @mouseleave='mouseleave'> <ul class='box1'><li> <img :src='http://www.cgvv.com.cn/bcjs/n' v-for='(n, i) in imgs' :key='i' alt='' : : /></li> </ul> <p @click='left'>&lt;</p> <p @click='right'>></p> </div> </div></template>

script代碼如下(示例):

<script>export default { name: 'Lunbo', props: ['imgs'], data() { return { // js中使用圖片,需要采用require導入 index: 1, hasAni: true, istrue: true, }; }, methods: { mouse() { clearInterval(this.timer); }, mouseleave() { this.timer = setInterval(() => {this.index++;this.hasAni = true;if (this.index == this.imgs.length - 1) { setTimeout(() => { this.index = 0; this.hasAni = false; }, 750);} }, 1500); }, right() { if (this.istrue) {this.index++;this.hasAni = true;this.istrue = false;if (this.index == this.imgs.length - 1) { setTimeout(() => { this.index = 1; this.hasAni = false; }, 750);}setTimeout(() => { this.istrue = true;}, 1000); } }, left() { if (this.istrue) {this.index--;this.hasAni = true;this.istrue = false;if (this.index == 0) { setTimeout(() => { this.index = this.imgs.length - 1; this.hasAni = false; }, 750);}setTimeout(() => { this.istrue = true;}, 1000); } }, }, activated() { console.log(1); this.timer = setInterval(() => { this.index++; this.hasAni = true; if (this.index == this.imgs.length - 1) {setTimeout(() => { this.index = 0; this.hasAni = false;}, 750); } }, 1500); }, decativated() { clearInterval(this.timer); },};</script>

css

<style scoped>p { width: 30px; height: 60px; background-color: rgba(46, 139, 86, 0.356); line-height: 60px; font-size: 24px; position: absolute; top: 105px;}.tt { left: 0;}.tt1 { right: 0;}.box { width: 500px; height: 300px; margin: 100px auto; position: relative; overflow: hidden;}.box1 img { position: absolute; left: 0px; top: 0; width: 500px; height: 300px;}.animaton { transition: left 0.75s;}</style>

2.父組件代碼

父組件

<keep-alive> <Lunbo :imgs='imgs' /></keep-alive>

導入模塊

import Lunbo from './components/Lunbo';

圖片數據

data() { return { imgs:[require('./assets/6.jpg'),require('./assets/1.jpg'),require('./assets/2.jpg'),require('./assets/3.jpg'),require('./assets/4.jpg'),require('./assets/5.jpg'),require('./assets/6.jpg'),require('./assets/1.jpg'), ], }

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

標簽: Vue
相關文章:
主站蜘蛛池模板: 亚洲国产精品区 | 久久亚洲精品中文字幕二区 | 亚洲性久久久影院 | 欧美一级纶理片免费 | 成人毛片网站 | 久久久久免费视频 | 在线小毛片 | 亚洲黄色在线播放 | 国产欧美一区二区三区视频在线观看 | 暖暖视频日韩欧美在线观看 | 国产日本韩国不卡在线视频 | 亚洲综合网址 | 波多野结衣一区二区三区高清在线 | 欧美美女视频网站 | 久久亚洲国产成人影院 | 国产成人a视频在线观看 | 特黄特a级特别特级特毛片 特黄特黄 | 91香蕉视频网 | 97免费在线观看视频 | 国产 日韩 欧美 在线 | ccav在线永久免费看 | 国内精品久久久久不卡 | 99在线热视频 | 亚洲影院中文字幕 | 欧美成人午夜不卡在线视频 | 久久九九爱 | 成人国产一区二区三区 | 99国产成人高清在线视频 | 日本69色视频在线观看 | 久久久精品视频免费观看 | 草久免费视频 | 亚洲成aⅴ人片在线影院八 亚洲成av人片在线观看 | 国产精品久久久免费视频 | 国产91久久最新观看地址 | 日韩国产成人精品视频 | 成人a毛片高清视频 | cao美女| 免费高清特黄a 大片 | 日韩精品福利视频一区二区三区 | 国产激情一区二区三区四区 | 美女免费在线视频 |