Authored by Tao

add channel

<template>
<LayoutApp :show-back="true">
<div class="scroll-list-wrap">
<template v-if="isShow">
<template v-if="!isShow">
<div v-for="(item, index) in channelList.list" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data.list"></ScrollNav>
<ScrollNav :list="item.data.list" :cur="cur"></ScrollNav>
</div>
</template>
<Scroll
... ... @@ -23,7 +23,7 @@
<TwoBanner :list="item.data" v-if="item.template_name == 'twoPicture'" />
<template v-if="!isShow">
<div ref="sss" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data.list"></ScrollNav>
<ScrollNav :list="item.data.list" :cur="cur" @transfer="getIndex"></ScrollNav>
</div>
</template>
</div>
... ... @@ -69,6 +69,7 @@ export default {
isShow: false,
total: 0,
marginTop: 0,
cur: 0,
}
},
computed: {
... ... @@ -81,24 +82,22 @@ export default {
isHome: true,
}
this.fetchChannelList().then((res)=>{
let windowH = document.documentElement.clientHeight || document.body.clientHeight;
this.navTop = this.$refs.sss[0].offsetTop;
this.navHeight = this.$refs.sss[0].offsetHeight;
let windowH = document.documentElement.clientHeight || document.body.clientHeight;
this.total = windowH - this.navHeight;
console.log(windowH);
console.log(this.navHeight);
console.log(this.total);
console.log("______");
});
this.fetchProductList(params);
},
created() {
},
methods: {
getIndex(index) {
this.cur = index;
console.log(this.cur);
},
scrollHandler({ y }) {
let scrollY = Math.abs(parseInt(y));
if(scrollY >= this.navTop) {
... ...
<template>
<div class="ScrollNav" ref="scrollNavtop" v-if="labels.length > 0">
<ScrollNavBar :current="current" :labels="labels" @change="changeHandler">
<div class="ScrollNav" v-if="labels.length > 0">
<ScrollNavBar :current="this.list[cur].tab_name" :labels="labels" @change="changeHandler">
<span slot-scope="props">
{{props.txt}}
<span :ref="`getindex${props.txt}`" v-show="false">{{props.index}}</span>
... ... @@ -23,6 +23,10 @@ export default {
type: Array,
default: true
},
cur: {
type: Number,
default: true
}
},
data() {
return {
... ... @@ -40,8 +44,6 @@ export default {
},
mounted() {
this.list.map((res) => { this.labels.push(res.tab_name) });
console.log(this.$refs.scrollNavtop);
console.log("this.$refs.xxx.offsetTop2");
},
created() {
... ... @@ -54,6 +56,8 @@ export default {
let params = Object.assign({},...query);
params.isReset = true; delete params.method;
this.fetchProductList(params);
console.log(index);
this.$emit('transfer',index);
}
}
};
... ...
... ... @@ -15,6 +15,7 @@ export default function() {
total: 0, // 总共多少条
scrollnavList: [], // 导航菜单
// scrollnavidList: [], // 导航菜单
current: 0,
},
},
mutations: {
... ...