refactor: 全局大小设置移除固定的size、新版的element-plus的size移除mini和medium的值

This commit is contained in:
郝先瑞
2022-02-20 00:17:46 +08:00
parent f5f295b028
commit 19a4ad7a12
25 changed files with 59 additions and 118 deletions

View File

@@ -13,9 +13,9 @@
<script setup lang="ts">
import {computed} from "vue";
import {tagsViewStoreHook} from '@/store/modules/tagsView'
import {useTagsViewStoreHook} from '@/store/modules/tagsView'
const cachedViews = computed(() => tagsViewStoreHook().cachedViews);
const cachedViews = computed(() => useTagsViewStoreHook().cachedViews);
</script>

View File

@@ -10,15 +10,15 @@
<!-- <search id="header-search" class="right-menu-item" />
<error-log class="errLog-container right-menu-item hover-effect" />-->
<screenfull id="screenfull" class="right-menu-item hover-effect"/>
<!--<el-tooltip content="Global Size" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>-->
<el-tooltip content="全局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect"/>
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar">
<CaretBottom style="width: .6em; height: .6em;" />
<CaretBottom style="width: .6em; height: .6em;"/>
</div>
<template #dropdown>
@@ -45,13 +45,14 @@
</div>
</template>
<script setup lang="ts">
import { computed} from "vue"
import {computed} from "vue"
import {ElMessageBox} from 'element-plus'
import {useRoute, useRouter} from "vue-router"
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import Hamburger from '@/components/Hamburger/index.vue'
import Screenfull from '@/components/screenfull/index.vue'
import {tagsViewStoreHook} from '@/store/modules/tagsView'
import SizeSelect from '@/components/SizeSelect/index.vue'
import {useTagsViewStoreHook} from '@/store/modules/tagsView'
import {useAppStoreHook} from '@/store/modules/app'
import {useUserStoreHook} from '@/store/modules/user'

View File

@@ -10,13 +10,13 @@
<script setup lang="ts">
import {ref, computed, onMounted, onBeforeUnmount, getCurrentInstance} from "vue";
import {tagsViewStoreHook} from "@/store/modules/tagsView"
import {TagView} from "@store/interface";
import {useTagsViewStoreHook} from "@/store/modules/tagsView"
import {TagView} from "@/store/interface";
const emits = defineEmits()
const tagAndTagSpacing = ref(4)
const scrollContainerRef = ref(null)
const visitedViews = computed(() => tagsViewStoreHook().visitedViews)
const visitedViews = computed(() => useTagsViewStoreHook().visitedViews)
const emitScroll = () => {
(emits as any)('scroll')

View File

@@ -47,7 +47,7 @@
<script lang="ts" setup>
import {tagsViewStoreHook} from '@/store/modules/tagsView'
import {useTagsViewStoreHook} from '@/store/modules/tagsView'
import {usePermissionStoreHook} from '@/store/modules/Permission'
import path from 'path-browserify'
import {
@@ -68,7 +68,7 @@ const {ctx} = getCurrentInstance() as any
const router = useRouter()
const route = useRoute();
const visitedViews = computed<any>(() => tagsViewStoreHook().visitedViews)
const visitedViews = computed<any>(() => useTagsViewStoreHook().visitedViews)
const routes = computed<any>(() => usePermissionStoreHook().routes)
const affixTags = ref([]);
@@ -121,14 +121,14 @@ function initTags() {
for (const tag of res) {
// Must have tag name
if ((tag as TagView).name) {
tagsViewStoreHook().addVisitedView(tag)
useTagsViewStoreHook().addVisitedView(tag)
}
}
}
function addTags() {
if (route.name) {
tagsViewStoreHook().addView(route)
useTagsViewStoreHook().addView(route)
}
return false
}
@@ -144,7 +144,7 @@ function moveToCurrentTag() {
(scrollPaneRef.value as any).value.moveToTarget(tag)
// when query is different then update
if ((tag.to as TagView).fullPath !== route.fullPath) {
tagsViewStoreHook().updateVisitedView(route)
useTagsViewStoreHook().updateVisitedView(route)
}
}
}
@@ -176,7 +176,7 @@ function isLastView() {
}
function refreshSelectedTag(view: TagView) {
tagsViewStoreHook().delCachedView(view)
useTagsViewStoreHook().delCachedView(view)
const {fullPath} = view
nextTick(() => {
router.replace({path: '/redirect' + fullPath}).catch(err => {
@@ -202,7 +202,7 @@ function toLastView(visitedViews: TagView[], view?: any) {
}
function closeSelectedTag(view: TagView) {
tagsViewStoreHook().delView(view).then((res: any) => {
useTagsViewStoreHook().delView(view).then((res: any) => {
if (isActive(view)) {
toLastView(res.visitedViews, view)
}
@@ -210,14 +210,14 @@ function closeSelectedTag(view: TagView) {
}
function closeLeftTags() {
tagsViewStoreHook().delLeftViews(selectedTag.value).then((res: any) => {
useTagsViewStoreHook().delLeftViews(selectedTag.value).then((res: any) => {
if (!res.visitedViews.find((item: any) => item.fullPath === route.fullPath)) {
toLastView(res.visitedViews)
}
})
}
function closeRightTags() {
tagsViewStoreHook().delRightViews(selectedTag.value).then((res:any) => {
useTagsViewStoreHook().delRightViews(selectedTag.value).then((res:any) => {
if (!res.visitedViews.find((item:any) => item.fullPath === route.fullPath)) {
toLastView(res.visitedViews)
}
@@ -225,13 +225,13 @@ function closeRightTags() {
}
function closeOtherTags() {
tagsViewStoreHook().delOtherViews(selectedTag.value).then(() => {
useTagsViewStoreHook().delOtherViews(selectedTag.value).then(() => {
moveToCurrentTag()
})
}
function closeAllTags(view: TagView) {
tagsViewStoreHook().delRightViews(selectedTag.value).then((res:any) => {
useTagsViewStoreHook().delRightViews(selectedTag.value).then((res:any) => {
if (affixTags.value.some((tag:any) => tag.path === route.path)) {
return
}