perf: 隐藏标签页功能优化

This commit is contained in:
lrl
2021-10-24 14:19:57 +08:00
committed by 啝裳
parent 822261c922
commit 8d2824fe82
3 changed files with 29 additions and 20 deletions

View File

@@ -1,6 +1,5 @@
<script setup lang="ts">
import { split } from "lodash-es";
import { nextTick } from "vue";
import panel from "../panel/index.vue";
import { useRouter } from "vue-router";
import { emitter } from "/@/utils/mitt";
@@ -52,11 +51,7 @@ if (settings.tagsVal === null) {
localOperate("tagsVal", false, "set");
settings.tagsVal = false;
}
nextTick(() => {
window.document
.querySelector(".app-main")
?.setAttribute("data-show-tag", settings.tagsVal);
});
window.document.body.setAttribute("data-show-tag", settings.tagsVal);
function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
const targetEl = target || document.body;

View File

@@ -447,9 +447,7 @@ onBeforeMount(() => {
emitter.on("tagViewsChange", key => {
if (unref(showTags) === key) return;
showTags.value = key;
window.document
.querySelector(".app-main")
?.setAttribute("data-show-tag", key);
window.document.body.setAttribute("data-show-tag", key);
});
// 改变标签风格