-
+
- {{ data }}
-
-
@@ -31,9 +29,10 @@
scrollAction(event)">
+
-
{{ data.title }}
+ {{ data.title }}
+
@@ -98,7 +97,7 @@ import HomeFooter from '@/views/newHome/components/Footer'
import HomeHeader from '@/views/home/components/header'
import CompareGroupView from '@/views/home/components/CompareGroupView'
import { pageWithAttrs } from '@/api/abilityStatistics'
-import { defineComponent, ref, onMounted, getCurrentInstance, computed, unref, reactive, nextTick } from 'vue';
+import { defineComponent, ref, onMounted, getCurrentInstance, computed, unref, reactive, nextTick, onCreated } from 'vue';
import { selectOne } from '@/api/home'
import { message, Tooltip, Table, Spin } from 'ant-design-vue'
import { useRouter } from 'vue-router';
@@ -261,13 +260,25 @@ let textObj = {
},
}
-const activeNameIndex = ref(0)
const showAddModal = ref(false)
const dataList = ref([])
const selectedRowKeys = ref([]);
let tableData = ref([])
const loadingPage = ref(false)
+const getId = () => {
+ return window.document.getElementById('bottomRef')
+}
+
+const handleClickTab = (e, link) => {
+ // 阻止点击的默认事件修改路由
+ e.preventDefault();
+ if (link.href) {
+ let ele = document.getElementById(link.href);
+ ele && ele.scrollIntoView({ block: 'start', behavior: 'smooth' });
+ }
+}
+
// 初始化
onMounted(() => {
selectedRowKeys.value.push(queryId)
@@ -278,64 +289,6 @@ onMounted(() => {
})
})
-// 滚动事件
-const scrollAction = (event) => {
- isScrollFlag.value = true;
- if (!isScrollFlag.value) {
- rrturn
- }
- const _scrollTop = event.target.scrollTop
- nextTick(() => {
- let len = navScrollTopArray.value.length;
- let min = navScrollTopArray.value[1].scrollTop
- let max = navScrollTopArray.value[len - 2].scrollTop;
- for (let index = 0; index < navScrollTopArray.value.length; index++) {
- const item = navScrollTopArray.value[index];
- if (index < len - 1) {
- if (_scrollTop > item.scrollTop && _scrollTop <= navScrollTopArray.value[index + 1].scrollTop) {
- activeNameIndex.value = index + 1;
- break;
- }
- }
- if (_scrollTop >= max) {
- activeNameIndex.value = len - 1;
- break;
- }
- if (_scrollTop <= min) {
- activeNameIndex.value = 0;
- break;
- }
- }
- })
-}
-
-let navScrollTopArray = ref([])
-// 获取元素距离顶部的位置
-const getNavscrollTop = () => {
- navScrollTopArray = ref([])
- leftNav.value.map((title, index) => {
- let realTop = ctx.refs[title][0].offsetTop;
- navScrollTopArray.value.push({
- scrollTop: realTop - 240,
- index: index
- })
- })
-}
-
-let isScrollFlag = ref(false)
-// 切换左侧
-const changeTab = (n, data) => {
- isScrollFlag.value = false;
- activeNameIndex.value = n;
- // 获取元素距离父元素的距离
- let realTop = ctx.refs[data][0].offsetTop;
- if (realTop || realTop === 0) {
- ctx.refs.bottomRef.scrollTo({
- 'top': realTop - 240,
- 'behavior': 'smooth'
- })
- }
-}
const initData = () => {
loadingPage.value = true;
@@ -350,11 +303,10 @@ const initData = () => {
detailArray.value.push(formatterData(data[index]))
}
}
- // 处理数据
- getNewData()
nextTick(() => {
- getNavscrollTop()
+ // 处理数据
+ getNewData()
})
loadingPage.value = false
@@ -588,6 +540,8 @@ const formatterData = (obj) => {
\ No newline at end of file