完成大数据弹窗轮播思路

Posted xhrr

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了完成大数据弹窗轮播思路相关的知识,希望对你有一定的参考价值。

 

1, 参考

技术图片

 

 2. 实现

data(){
    return {
            newTimer: null,
            imglist: [],
            imglistLine: [],
            index: 0,
            index1: 0
    }
}

 

 methods:{
        // 轮播
        aa(){
            if ( ++(this.index) >= this.imglist.length) {
                this.index = 0
            }
            if ( ++(this.index1) >= this.imglistLine.length) {
                this.index1 = 0
            };
            this.changeImg(this.index);
            console.log(‘kaishil‘)
        },
        changeImg(curIndex) {
            for (var i = 0; i < this.imglist.length; i++) {
                this.imglist[i].style.opacity = 0;
                this.imglist[i].style.width = 0;
                this.imglist[i].style.height = 0;
                this.imglist[i].style.overflow = ‘hidden‘;
                this.imglist[i].style.padding = 0;
            }
            this.imglist[curIndex].style.opacity = 1;
            this.imglist[curIndex].style.width = ‘219px‘;
            this.imglist[curIndex].style.height = ‘94px‘;
            this.imglist[curIndex].style.overflow = ‘hidden‘;
            this.imglist[curIndex].style.padding = ‘9px‘;

            for (var i = 0; i < this.imglistLine.length; i++) {
                this.imglistLine[i].style.opacity = 0;
                this.imglistLine[i].style.width = 0;
                this.imglistLine[i].style.height = 0;
                this.imglistLine[i].style.overflow = ‘hidden‘;
            }
            this.imglistLine[curIndex].style.opacity = 1;
            this.imglistLine[curIndex].style.width = ‘97px‘;
            this.imglistLine[curIndex].style.height = ‘52px‘;
            this.imglistLine[curIndex].style.overflow = ‘auto‘;
        },
        stopTimer(){
            clearInterval(this.newTimer);
            console.log(‘清除了‘)
        },
        begTimer(){
            var that = this
            setInterval(
            function(){
                that.aa()
            },2000)
        },
}
mounted(){
       this.imglist = [this.$refs.smDom, this.$refs.hlDom, this.$refs.gpDom, this.$refs.hdDom, this.$refs.waDom, this.$refs.zzDom, this.$refs.qyDom, this.$refs.ssDom]
        this.imglistLine = [this.$refs.smDomLine, this.$refs.hlDomLine, this.$refs.gpDomLine, this.$refs.hdDomLine, this.$refs.waDomLine, this.$refs.zzDomLine, this.$refs.qyDomLine, this.$refs.ssDomLine]
        this.newTimer = setInterval(function(){
            that.aa()
            console.log(‘开始‘)
        },2000);
}

 

以上是关于完成大数据弹窗轮播思路的主要内容,如果未能解决你的问题,请参考以下文章

vue鼠标悬停事件监听

JavaScript的案例(数据校验,js轮播图,页面定时弹窗)

jQuery无缝轮播图思路详解-唯品会

图片轮播-swiper动态加载

html设置注册窗口弹出来的窗口被轮播图挡住了

js实现左右切换轮播图思路