/** * 顶部header */ Vue.component("screen-foot", { template: `
{{item.text}}
`, props: { data:{ type:Array }, indexes:{ type:Number } }, data() { return { bottom:false, width:0, index:2, active:0, length: 0, interval:undefined, } }, mounted(){ this.init() }, methods: { init(){ this.divWidth(); this.active = this.indexes this.index = this.indexes var that = this // this.interval = setInterval(that.timer,600000); }, footMouseover(){ let bottom = this.$refs.foot if(this.bottom == false){ bottom.style.bottom = 0 this.bottom =true } }, footMouseout(){ let bottom = this.$refs.foot if(this.bottom == true){ bottom.style.bottom = -90+'px' this.bottom =false } }, divWidth(){ var width = this.data.length * 250 this.width = width this.length =this.data.length }, leftClick(){ let slider = this.$refs.tabs if(slider.style.left == '500px'){ }else{ this.index = this.index+1 this.active = this.active-1 } this.$emit('indexes',this.active); }, rightClick(){ let slider = this.$refs.tabs if(slider.style.left == -(this.length - 3)*250+'px'){ }else{ this.index = this.index-1 this.active = this.active+1 } this.$emit('indexes',this.active); }, footTabs(i){ this.active = i this.index = 2 - i; this.$emit('indexes',this.active); }, timer(){ let slider = this.$refs.tabs if(slider.style.left == -(this.length - 3)*250+'px'){ this.index = 2 this.active = 0 }else{ this.index = this.index - 1 this.active = 2 - this.index } this.$emit('indexes',this.active); } }, watch:{ index:function () { this.init() } }, })