fix(ScrollPane.vue): 新版本el-scrollbarref属性名变动导致addEventListener undefined

Former-commit-id: 1dea3d677c3a2ce362021a4ea1974930310d127f
This commit is contained in:
haoxr
2022-11-21 22:52:57 +08:00
parent fe6669d813
commit 8793c9b3e3

View File

@@ -15,7 +15,7 @@ import {
computed,
onMounted,
onBeforeUnmount,
getCurrentInstance,
getCurrentInstance
} from 'vue';
import useStore from '@/store';
import { TagView } from '@/store/modules/types';
@@ -32,7 +32,9 @@ const { tagsView } = useStore();
const visitedViews = computed(() => tagsView.visitedViews);
const scrollWrapper = computed(() => proxy?.$refs.scrollContainer.$refs.wrap$);
const scrollWrapper = computed(
() => proxy?.$refs.scrollContainer.$refs.wrapRef
);
onMounted(() => {
scrollWrapper.value.addEventListener('scroll', emitScroll, true);
@@ -68,7 +70,7 @@ function moveToTarget(currentTag: TagView) {
} else {
const tagListDom = document.getElementsByClassName('tags-view__item');
const currentIndex = visitedViews.value.findIndex(
(item) => item === currentTag
item => item === currentTag
);
let prevTag = null;
let nextTag = null;
@@ -107,7 +109,7 @@ function moveToTarget(currentTag: TagView) {
}
defineExpose({
moveToTarget,
moveToTarget
});
</script>