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

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

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