关于索引栏的使用 #12127
Closed
liujinwang223
started this conversation in
General
关于索引栏的使用
#12127
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
/当前有这样一个需求,是完成一个选择人员列表的组件,索引栏部分点击abc时跳的锚点被导航栏掩盖了,当前使用如下方法 依旧没有办法隔开用户列表 代码如下
方法调用如下
const onIndexSelect = (index:any) => {
console.log(index);
// indexBarTo.value?.scrollTo(index);
const targetElement = document.getElementById(
md${index}
);console.log(targetElement)
if (targetElement) {
// 跳转到锚点位置,并向下预留导航栏高度(假设导航栏高度为 60px)
const offset = targetElement.offsetTop -60;
console.log(offset)
indexBarTo.value?.scrollTo(offset);
}
}
Beta Was this translation helpful? Give feedback.
All reactions