提交 3fcbd549 编写于 作者: 郝先瑞

fix: 修复控制台的一些警告问题

上级 c03db1d1
......@@ -58,7 +58,7 @@ watch(show, value => {
});
function addEventClick() {
window.addEventListener('click', closeSidebar);
window.addEventListener('click', closeSidebar, {passive:true});
}
function closeSidebar(evt: any) {
......
......@@ -35,7 +35,7 @@ const visitedViews = computed(() => tagsView.visitedViews);
const scrollWrapper = computed(() => proxy?.$refs.scrollContainer.$refs.wrap$);
onMounted(() => {
scrollWrapper.value.addEventListener('scroll', emitScroll, true)
scrollWrapper.value.addEventListener('scroll', emitScroll, {passive:true})
})
onBeforeUnmount(() => {
scrollWrapper.value.removeEventListener('scroll', emitScroll)
......@@ -81,8 +81,7 @@ function moveToTarget(currentTag: TagView) {
) {
prevTag = tagListDom[k];
}
if (
(tagListDom[k] as any).dataset.path ===
if ((tagListDom[k] as any).dataset.path ===
visitedViews.value[currentIndex + 1].path
) {
nextTag = tagListDom[k];
......
......@@ -8,6 +8,7 @@
<router-link
v-for="tag in visitedViews"
:key="tag.path"
:data-path="tag.path"
:class="isActive(tag) ? 'active' : ''"
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
class="tags-view__item"
......@@ -64,8 +65,7 @@ import {
nextTick,
ref,
watch,
onMounted,
ComponentInternalInstance
onMounted
} from 'vue';
import path from 'path-browserify';
......@@ -80,7 +80,7 @@ import useStore from '@/store';
const { tagsView, permission } = useStore();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { proxy } = getCurrentInstance() as any;
const router = useRouter();
const route = useRoute();
......@@ -108,7 +108,7 @@ watch(
watch(visible, value => {
if (value) {
document.body.addEventListener('click', closeMenu);
document.body.addEventListener('click', closeMenu, {passive:true});
} else {
document.body.removeEventListener('click', closeMenu);
}
......
......@@ -9,6 +9,8 @@ import 'element-plus/theme-chalk/index.css';
import Pagination from '@/components/Pagination/index.vue';
import '@/permission';
import 'default-passive-events'
// 引入svg注册脚本
import 'virtual:svg-icons-register';
......
......@@ -16,7 +16,7 @@ export default function () {
};
const initResizeEvent = () => {
window.addEventListener('resize', chartResizeHandler);
window.addEventListener('resize', chartResizeHandler, {passive:true});
};
const destroyResizeEvent = () => {
......@@ -28,7 +28,8 @@ export default function () {
if (sidebarElm.value) {
sidebarElm.value.addEventListener(
'transitionend',
sidebarResizeHandler as EventListener
sidebarResizeHandler as EventListener,
{passive:true}
);
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册