|
|
@@ -25,16 +25,16 @@
|
|
|
<img src="../../assets/img/contCun/1001.png" alt="" />
|
|
|
<div class="leftRow">
|
|
|
<div
|
|
|
- @click="cutScroll(item.id, index)"
|
|
|
+ @click="cutScroll(index)"
|
|
|
class="row"
|
|
|
- :class="{ leAc: leftInd === item.id }"
|
|
|
+ :class="{ leAc: pageInd === index }"
|
|
|
v-for="(item, index) in leftData"
|
|
|
:key="item.id"
|
|
|
>
|
|
|
<img
|
|
|
:src="
|
|
|
require(`@/assets/img/conBs${
|
|
|
- leftInd === item.id ? 'Ac' : ''
|
|
|
+ pageInd === index ? 'Ac' : ''
|
|
|
}.png`)
|
|
|
"
|
|
|
alt=""
|
|
|
@@ -45,8 +45,8 @@
|
|
|
</div>
|
|
|
<!-- 主要切换内容 -->
|
|
|
<div class="right">
|
|
|
- <Son1 @pageNext="pageNext" v-if="leftInd.includes('100')" />
|
|
|
- <Son2 @pageNext="pageNext" v-else-if="leftInd.includes('200')" />
|
|
|
+ <Son1 @pageNext="pageNext" v-if="topDataInd === '1000'" />
|
|
|
+ <Son2 @pageNext="pageNext" v-else-if="topDataInd === '2000'" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -58,17 +58,18 @@ import Son1 from "./components/Son1.vue";
|
|
|
import Son2 from "./components/Son2.vue";
|
|
|
export default {
|
|
|
name: "info",
|
|
|
- components: { Son1,Son2 },
|
|
|
+ components: { Son1, Son2 },
|
|
|
data() {
|
|
|
//这里存放数据
|
|
|
return {
|
|
|
- leftInd: "1001",
|
|
|
leftData: [],
|
|
|
topDataInd: "1000",
|
|
|
topData: [],
|
|
|
// 一个内容的高度
|
|
|
pageHeight: null,
|
|
|
pageInd: 0,
|
|
|
+ downSrool: 0,
|
|
|
+ sroolFlag: true,
|
|
|
};
|
|
|
},
|
|
|
//监听属性 类似于data概念
|
|
|
@@ -78,16 +79,6 @@ export default {
|
|
|
pageInd(val) {
|
|
|
let dom = document.querySelector(".conten");
|
|
|
dom.scrollTo({ top: this.pageHeight * val, behavior: "smooth" });
|
|
|
- },
|
|
|
- },
|
|
|
- //方法集合
|
|
|
- methods: {
|
|
|
- pageNext(id, index) {
|
|
|
- this.cutScroll(id, index);
|
|
|
- },
|
|
|
- cutScroll(id, index) {
|
|
|
- this.leftInd = id;
|
|
|
- this.pageInd = index;
|
|
|
// 切换的时候暂时视频
|
|
|
this.$nextTick(() => {
|
|
|
setTimeout(() => {
|
|
|
@@ -98,13 +89,21 @@ export default {
|
|
|
}, 100);
|
|
|
});
|
|
|
},
|
|
|
+ },
|
|
|
+ //方法集合
|
|
|
+ methods: {
|
|
|
+ pageNext(index) {
|
|
|
+ this.cutScroll(index);
|
|
|
+ },
|
|
|
+ cutScroll(index) {
|
|
|
+ this.pageInd = index;
|
|
|
+ },
|
|
|
cutInfo(id, val) {
|
|
|
let dom = document.querySelector(".conten");
|
|
|
dom.scrollTo({ top: 0, behavior: "smooth" });
|
|
|
- this.leftInd = val[0].id;
|
|
|
this.topDataInd = id;
|
|
|
this.leftData = val;
|
|
|
- this.pageInd=0
|
|
|
+ this.pageInd = 0;
|
|
|
},
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
@@ -120,6 +119,69 @@ export default {
|
|
|
// 获取一个页面的高度
|
|
|
let domH = document.querySelector(".conten .right");
|
|
|
this.pageHeight = domH.clientHeight;
|
|
|
+ // 获取滚动元素
|
|
|
+ // let sroolDom = document.querySelector(".info .conten");
|
|
|
+ // sroolDom.addEventListener(
|
|
|
+ // "wheel",
|
|
|
+ // (e) => {
|
|
|
+ // let evt = e || sroolDom.event; //考虑兼容性
|
|
|
+ // let dom = evt.target;
|
|
|
+ // if (dom.className.includes("sroolStop")) {
|
|
|
+ // // 可能会有滚动条的元素
|
|
|
+ // if (dom.scrollHeight > dom.clientHeight) {
|
|
|
+ // // 确定有滚动条的元素
|
|
|
+ // dom.addEventListener("scroll", () => {
|
|
|
+ // const clientHeight = dom.clientHeight;
|
|
|
+ // const scrollTop = dom.scrollTop;
|
|
|
+ // const scrollHeight = dom.scrollHeight;
|
|
|
+ // // console.log(clientHeight , scrollTop,scrollHeight);
|
|
|
+ // if (
|
|
|
+ // clientHeight + scrollTop < scrollHeight &&
|
|
|
+ // scrollTop !== 0
|
|
|
+ // ) {
|
|
|
+ // console.log("在元素中滚动");
|
|
|
+ // this.sroolFlag = false;
|
|
|
+ // return;
|
|
|
+ // } else {
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.sroolFlag = true;
|
|
|
+ // }, 100);
|
|
|
+ // console.log("滚动到了顶部或者底部");
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // // evt.preventDefault();
|
|
|
+ // if (this.sroolFlag) {
|
|
|
+ // if (evt.deltaY > 0) {
|
|
|
+ // //在火狐中 向下滚动是3 谷歌是125
|
|
|
+ // this.downSrool++;
|
|
|
+ // if (this.downSrool > 2) {
|
|
|
+ // // 删除元素滚动事件
|
|
|
+ // this.downSrool = 0;
|
|
|
+ // if (this.pageInd === this.leftData.length - 1) return;
|
|
|
+ // this.pageInd++;
|
|
|
+ // // console.log("向下滚动");
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // this.downSrool--;
|
|
|
+ // if (this.downSrool < -2) {
|
|
|
+ // this.downSrool = 0;
|
|
|
+ // if (this.pageInd === 0) return;
|
|
|
+ // this.pageInd--;
|
|
|
+
|
|
|
+ // // console.log("向上滚动");
|
|
|
+ // }
|
|
|
+ // //在火狐中 向上滚动是-3 谷歌是-125
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // // //检查事件
|
|
|
+ // // console.log(evt.type, evt.deltaX, evt.deltaY, evt.deltaZ);
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // passive: false,
|
|
|
+ // }
|
|
|
+ // );
|
|
|
});
|
|
|
},
|
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
|
@@ -176,10 +238,28 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .conten::-webkit-scrollbar {
|
|
|
+ /*滚动条整体样式*/
|
|
|
+ width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
|
|
|
+ height: 1px;
|
|
|
+ }
|
|
|
+ .conten::-webkit-scrollbar-thumb {
|
|
|
+ /*滚动条里面小方块*/
|
|
|
+ border-radius: 10px;
|
|
|
+ -webkit-box-shadow: inset 0 0 5px transparent;
|
|
|
+ background: #8a7351;
|
|
|
+ }
|
|
|
+ .conten::-webkit-scrollbar-track {
|
|
|
+ /*滚动条里面轨道*/
|
|
|
+ -webkit-box-shadow: inset 0 0 5px transparent;
|
|
|
+ border-radius: 10px;
|
|
|
+ background: transparent;
|
|
|
+ }
|
|
|
.conten {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
overflow: hidden;
|
|
|
+ // overflow-y: auto;
|
|
|
padding: 100px 140px 0;
|
|
|
background: url("../../assets/img/contenBG.png");
|
|
|
.left {
|