'admin-21.08.22:修复优化诸多内容,请查看CHANGELOG.md文件'

This commit is contained in:
lyt-Top 2021-08-22 18:05:26 +08:00
parent a4da51c179
commit 8b1c80a8d4
11 changed files with 123 additions and 81 deletions

View File

@ -2,6 +2,18 @@
🎉🎉🔥 `vue-next-admin` 基于 vue3.x 、Typescript、vite、Element plus 等适配手机、平板、pc 的后台开源免费模板库vue2.x 请切换 vue-prev-admin 分支) 🎉🎉🔥 `vue-next-admin` 基于 vue3.x 、Typescript、vite、Element plus 等适配手机、平板、pc 的后台开源免费模板库vue2.x 请切换 vue-prev-admin 分支)
## 1.0.17
`2021.08.22`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 去除设置布局切换重置主题样式initSetLayoutChange切换布局需手动设置样式设置的样式自动同步各布局
- 🎯 优化 Dropdown 下拉菜单用户账号靠边时换行问题
- 🎯 优化 左侧导航菜单,共用菜单树,防止 `布局配置` 设置 `菜单 / 顶栏` 时,样式丢失等问题
- 🐞 修复 固定 header 后没有回到顶部的 bug拉取项目后运行不起来的 bug。<a href="https://gitee.com/lyt-top/vue-next-admin/pulls/14" target="_blank">!14</a>,感谢<a href="https://gitee.com/wjs0509" target="_blank">@wjs0509</a>
- 🐞 修复 tagView 右键全屏后,浏览器窗口大小发生任何变化都会导致左边菜单显示出来,并且可点击打开对应页面。<a href="https://gitee.com/lyt-top/vue-next-admin/issues/I46E6T" target="_blank">I46E6T</a>
- 🐞 修复 默认设置 `菜单 / 顶栏` 样式不生效问题(/@/src/store/modules/themeConfig.ts
## 1.0.16 ## 1.0.16
`2021.08.14` `2021.08.14`

View File

@ -13,7 +13,7 @@
"echarts": "^5.1.2", "echarts": "^5.1.2",
"echarts-gl": "^2.0.8", "echarts-gl": "^2.0.8",
"echarts-wordcloud": "^2.0.0", "echarts-wordcloud": "^2.0.0",
"element-plus": "^1.0.2-beta.70", "element-plus": "^1.0.2-beta.71",
"mitt": "^3.0.0", "mitt": "^3.0.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"print-js": "^1.6.0", "print-js": "^1.6.0",
@ -28,26 +28,26 @@
"vue-router": "^4.0.10", "vue-router": "^4.0.10",
"vue-web-screen-shot": "^1.2.0", "vue-web-screen-shot": "^1.2.0",
"vuex": "^4.0.2", "vuex": "^4.0.2",
"wangeditor": "^4.7.6" "wangeditor": "^4.7.7"
}, },
"devDependencies": { "devDependencies": {
"@types/axios": "^0.14.0", "@types/axios": "^0.14.0",
"@types/clipboard": "^2.0.1", "@types/clipboard": "^2.0.1",
"@types/node": "^16.6.1", "@types/node": "^16.7.1",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/sortablejs": "^1.10.7", "@types/sortablejs": "^1.10.7",
"@typescript-eslint/eslint-plugin": "^4.29.1", "@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.1", "@typescript-eslint/parser": "^4.29.2",
"@vitejs/plugin-vue": "^1.4.0", "@vitejs/plugin-vue": "^1.4.0",
"@vue/compiler-sfc": "^3.2.2", "@vue/compiler-sfc": "^3.2.4",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-plugin-vue": "^7.16.0", "eslint-plugin-vue": "^7.16.0",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"sass": "^1.37.5", "sass": "^1.38.0",
"sass-loader": "^12.1.0", "sass-loader": "^12.1.0",
"typescript": "^4.3.5", "typescript": "^4.3.5",
"vite": "^2.4.4", "vite": "^2.5.0",
"vue-eslint-parser": "^7.10.0" "vue-eslint-parser": "^7.10.0"
}, },
"browserslist": [ "browserslist": [

View File

@ -1,20 +1,12 @@
<template> <template>
<template v-if="clientWidth > 1000"> <div class="h100" v-show="!isTagsViewCurrenFull">
<el-aside class="layout-aside" :class="setCollapseWidth" v-show="!isTagsViewCurrenFull"> <el-aside class="layout-aside" :class="setCollapseStyle">
<Logo v-if="setShowLogo" />
<el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef">
<Vertical :menuList="menuList" :class="setCollapseWidth" />
</el-scrollbar>
</el-aside>
</template>
<el-drawer v-model="getThemeConfig.isCollapse" :with-header="false" direction="ltr" size="220px" v-else>
<el-aside class="layout-aside w100 h100">
<Logo v-if="setShowLogo" /> <Logo v-if="setShowLogo" />
<el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef"> <el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef">
<Vertical :menuList="menuList" /> <Vertical :menuList="menuList" />
</el-scrollbar> </el-scrollbar>
</el-aside> </el-aside>
</el-drawer> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -41,25 +33,50 @@ export default {
return store.state.tagsViewRoutes.isTagsViewCurrenFull; return store.state.tagsViewRoutes.isTagsViewCurrenFull;
}); });
// / // /
const setCollapseWidth = computed(() => { const setCollapseStyle = computed(() => {
let { layout, isCollapse, menuBar } = store.state.themeConfig.themeConfig; const { layout, isCollapse, menuBar } = store.state.themeConfig.themeConfig;
let asideBrColor = menuBar === '#FFFFFF' || menuBar === '#FFF' || menuBar === '#fff' || menuBar === '#ffffff' ? 'layout-el-aside-br-color' : ''; const asideBrColor =
if (layout === 'columns') { menuBar === '#FFFFFF' || menuBar === '#FFF' || menuBar === '#fff' || menuBar === '#ffffff' ? 'layout-el-aside-br-color' : '';
// 1px //
if (state.clientWidth <= 1000) {
if (isCollapse) { if (isCollapse) {
return ['layout-aside-width1', asideBrColor]; document.body.setAttribute('class', 'el-popup-parent--hidden');
const asideEle = document.querySelector('.layout-container') as HTMLElement;
const modeDivs = document.createElement('div');
modeDivs.setAttribute('class', 'layout-aside-mobile-mode');
asideEle.appendChild(modeDivs);
modeDivs.addEventListener('click', closeLayoutAsideMobileMode);
return [asideBrColor, 'layout-aside-mobile', 'layout-aside-mobile-open'];
} else { } else {
return ['layout-aside-width-default', asideBrColor]; //
closeLayoutAsideMobileMode();
return [asideBrColor, 'layout-aside-mobile', 'layout-aside-mobile-close'];
} }
} else { } else {
// 64px if (layout === 'columns') {
if (isCollapse) { // 1px
return ['layout-aside-width64', asideBrColor]; if (isCollapse) {
return [asideBrColor, 'layout-aside-pc-1'];
} else {
return [asideBrColor, 'layout-aside-pc-220'];
}
} else { } else {
return ['layout-aside-width-default', asideBrColor]; // 64px
if (isCollapse) {
return [asideBrColor, 'layout-aside-pc-64'];
} else {
return [asideBrColor, 'layout-aside-pc-220'];
}
} }
} }
}); });
//
const closeLayoutAsideMobileMode = () => {
const el = document.querySelector('.layout-aside-mobile-mode');
el && el.parentNode?.removeChild(el);
store.state.themeConfig.themeConfig.isCollapse = false;
document.body.setAttribute('class', '');
};
// / logo // / logo
const setShowLogo = computed(() => { const setShowLogo = computed(() => {
let { layout, isShowLogo } = store.state.themeConfig.themeConfig; let { layout, isShowLogo } = store.state.themeConfig.themeConfig;
@ -118,10 +135,11 @@ export default {
}); });
proxy.mittBus.on('layoutMobileResize', (res: any) => { proxy.mittBus.on('layoutMobileResize', (res: any) => {
initMenuFixed(res.clientWidth); initMenuFixed(res.clientWidth);
closeLayoutAsideMobileMode();
}); });
}); });
return { return {
setCollapseWidth, setCollapseStyle,
setShowLogo, setShowLogo,
getThemeConfig, getThemeConfig,
isTagsViewCurrenFull, isTagsViewCurrenFull,

View File

@ -3,9 +3,9 @@
<ColumnsAside /> <ColumnsAside />
<div class="layout-columns-warp"> <div class="layout-columns-warp">
<Aside /> <Aside />
<el-container class="flex-center layout-backtop" :class="{'layout-backtop':!isFixedHeader}"> <el-container class="flex-center layout-backtop" :class="{ 'layout-backtop': !isFixedHeader }">
<Header v-if="isFixedHeader" /> <Header v-if="isFixedHeader" />
<el-scrollbar :class="{'layout-backtop':isFixedHeader}"> <el-scrollbar :class="{ 'layout-backtop': isFixedHeader }">
<Header v-if="!isFixedHeader" /> <Header v-if="!isFixedHeader" />
<Main /> <Main />
</el-scrollbar> </el-scrollbar>

View File

@ -1,9 +1,9 @@
<template> <template>
<el-container class="layout-container"> <el-container class="layout-container">
<Aside /> <Aside />
<el-container class="flex-center" :class="{'layout-backtop':!isFixedHeader}"> <el-container class="flex-center" :class="{ 'layout-backtop': !isFixedHeader }">
<Header v-if="isFixedHeader" /> <Header v-if="isFixedHeader" />
<el-scrollbar ref="layoutDefaultsScrollbarRef" :class="{'layout-backtop':isFixedHeader}"> <el-scrollbar ref="layoutDefaultsScrollbarRef" :class="{ 'layout-backtop': isFixedHeader }">
<Header v-if="!isFixedHeader" /> <Header v-if="!isFixedHeader" />
<Main /> <Main />
</el-scrollbar> </el-scrollbar>
@ -23,7 +23,7 @@ export default {
name: 'layoutDefaults', name: 'layoutDefaults',
components: { Aside, Header, Main }, components: { Aside, Header, Main },
setup() { setup() {
const { proxy }:any = getCurrentInstance(); const { proxy } = getCurrentInstance() as any;
const store = useStore(); const store = useStore();
const route = useRoute(); const route = useRoute();
const isFixedHeader = computed(() => { const isFixedHeader = computed(() => {

View File

@ -109,7 +109,6 @@ export default {
align-items: center; align-items: center;
padding-right: 15px; padding-right: 15px;
background: var(--bg-topBar); background: var(--bg-topBar);
overflow: hidden;
border-bottom: 1px solid #f1f2f3; border-bottom: 1px solid #f1f2f3;
} }
</style> </style>

View File

@ -518,38 +518,9 @@ export default defineComponent({
if (getThemeConfig.value.layout === layout) return false; if (getThemeConfig.value.layout === layout) return false;
getThemeConfig.value.layout = layout; getThemeConfig.value.layout = layout;
getThemeConfig.value.isDrawer = false; getThemeConfig.value.isDrawer = false;
initSetLayoutChange(); initLayoutChangeFun();
onMenuBarHighlightChange(); onMenuBarHighlightChange();
}; };
//
const initSetLayoutChange = () => {
if (getThemeConfig.value.layout === 'classic') {
getThemeConfig.value.menuBar = '#FFFFFF';
getThemeConfig.value.menuBarColor = '#606266';
getThemeConfig.value.topBar = '#ffffff';
getThemeConfig.value.topBarColor = '#606266';
initLayoutChangeFun();
} else if (getThemeConfig.value.layout === 'transverse') {
getThemeConfig.value.menuBarColor = '#FFFFFF';
getThemeConfig.value.topBar = '#545c64';
getThemeConfig.value.topBarColor = '#FFFFFF';
initLayoutChangeFun();
} else if (getThemeConfig.value.layout === 'columns') {
// 1.0.11
getThemeConfig.value.isShowLogo = false;
getThemeConfig.value.menuBar = '#FFFFFF';
getThemeConfig.value.menuBarColor = '#606266';
getThemeConfig.value.topBar = '#ffffff';
getThemeConfig.value.topBarColor = '#606266';
initLayoutChangeFun();
} else {
getThemeConfig.value.menuBar = '#545c64';
getThemeConfig.value.menuBarColor = '#eaeaea';
getThemeConfig.value.topBar = '#FFFFFF';
getThemeConfig.value.topBarColor = '#606266';
initLayoutChangeFun();
}
};
// //
const initLayoutChangeFun = () => { const initLayoutChangeFun = () => {
onBgColorPickerChange('menuBar'); onBgColorPickerChange('menuBar');
@ -606,7 +577,7 @@ export default defineComponent({
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
// logo // logo
if (!Local.get('frequency')) initSetLayoutChange(); if (!Local.get('frequency')) initLayoutChangeFun();
Local.set('frequency', 1); Local.set('frequency', 1);
// 退() // 退()
proxy.mittBus.on('onSignInClick', () => { proxy.mittBus.on('onSignInClick', () => {
@ -620,7 +591,7 @@ export default defineComponent({
proxy.mittBus.on('layoutMobileResize', (res: any) => { proxy.mittBus.on('layoutMobileResize', (res: any) => {
getThemeConfig.value.layout = res.layout; getThemeConfig.value.layout = res.layout;
getThemeConfig.value.isDrawer = false; getThemeConfig.value.isDrawer = false;
initSetLayoutChange(); initLayoutChangeFun();
onMenuBarHighlightChange(); onMenuBarHighlightChange();
}); });
setTimeout(() => { setTimeout(() => {

View File

@ -3,7 +3,7 @@
router router
:default-active="defaultActive" :default-active="defaultActive"
background-color="transparent" background-color="transparent"
:collapse="setIsCollapse" :collapse="isCollapse"
:unique-opened="getThemeConfig.isUniqueOpened" :unique-opened="getThemeConfig.isUniqueOpened"
:collapse-transition="false" :collapse-transition="false"
> >
@ -29,7 +29,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { toRefs, reactive, computed, defineComponent, getCurrentInstance, onMounted } from 'vue'; import { toRefs, reactive, computed, defineComponent, getCurrentInstance, onMounted, watch } from 'vue';
import { useRoute, onBeforeRouteUpdate } from 'vue-router'; import { useRoute, onBeforeRouteUpdate } from 'vue-router';
import { useStore } from '/@/store/index'; import { useStore } from '/@/store/index';
import SubItem from '/@/layout/navMenu/subItem.vue'; import SubItem from '/@/layout/navMenu/subItem.vue';
@ -49,6 +49,7 @@ export default defineComponent({
const state = reactive({ const state = reactive({
// https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G // https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
defaultActive: route.meta.isDynamic ? route.meta.isDynamicPath : route.path, defaultActive: route.meta.isDynamic ? route.meta.isDynamicPath : route.path,
isCollapse: false,
}); });
// //
const menuLists = computed(() => { const menuLists = computed(() => {
@ -58,10 +59,6 @@ export default defineComponent({
const getThemeConfig = computed(() => { const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig; return store.state.themeConfig.themeConfig;
}); });
// /
const setIsCollapse = computed(() => {
return document.body.clientWidth < 1000 ? false : getThemeConfig.value.isCollapse;
});
// //
const setParentHighlight = (currentRoute) => { const setParentHighlight = (currentRoute) => {
const { path, meta } = currentRoute; const { path, meta } = currentRoute;
@ -69,6 +66,16 @@ export default defineComponent({
if (pathSplit.length >= 4 && meta.isHide) return pathSplit.splice(0, 3).join('/'); if (pathSplit.length >= 4 && meta.isHide) return pathSplit.splice(0, 3).join('/');
else return path; else return path;
}; };
// /
watch(
store.state.themeConfig.themeConfig,
() => {
document.body.clientWidth <= 1000 ? (state.isCollapse = false) : (state.isCollapse = getThemeConfig.value.isCollapse);
},
{
immediate: true,
}
);
// //
onMounted(() => { onMounted(() => {
state.defaultActive = setParentHighlight(route); state.defaultActive = setParentHighlight(route);
@ -84,7 +91,6 @@ export default defineComponent({
return { return {
menuLists, menuLists,
getThemeConfig, getThemeConfig,
setIsCollapse,
...toRefs(state), ...toRefs(state),
}; };
}, },

View File

@ -5,6 +5,7 @@ import { ThemeConfigState, RootStateTypes } from '/@/store/interface/index';
/** /**
* 2020.05.28 by lyt * 2020.05.28 by lyt
* `window.localStorage` * `window.localStorage`
* pr💕
*/ */
const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = { const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
namespaced: true, namespaced: true,
@ -29,8 +30,9 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
/** /**
* / * /
* /@/layout/navBars/breadcrumb/setings.vue * v1.0.17 initSetLayoutChange
* `initSetLayoutChange(设置布局切换,重置主题样式)` *
* /@/layout/navBars/breadcrumb/setings.vue
*/ */
// 默认顶栏导航背景颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值 // 默认顶栏导航背景颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
topBar: '#ffffff', topBar: '#ffffff',

View File

@ -65,18 +65,44 @@ body,
.layout-el-aside-br-color { .layout-el-aside-br-color {
border-right: 1px solid rgb(238, 238, 238); border-right: 1px solid rgb(238, 238, 238);
} }
.layout-aside-width-default { // pc端左侧导航样式
.layout-aside-pc-220 {
width: 220px !important; width: 220px !important;
transition: width 0.3s ease; transition: width 0.3s ease;
} }
.layout-aside-width64 { .layout-aside-pc-64 {
width: 64px !important; width: 64px !important;
transition: width 0.3s ease; transition: width 0.3s ease;
} }
.layout-aside-width1 { .layout-aside-pc-1 {
width: 1px !important; width: 1px !important;
transition: width 0.3s ease; transition: width 0.3s ease;
} }
// 手机端左侧导航样式
.layout-aside-mobile {
position: fixed;
top: 0;
left: -220px;
width: 220px;
z-index: 1;
}
.layout-aside-mobile-close {
left: -220px;
transition: all 0.3s cubic-bezier(0.71, -0.01, 0.18, 0.95);
}
.layout-aside-mobile-open {
left: 0;
transition: all 0.3s cubic-bezier(0.53, -0.26, 0.42, 1.18);
}
.layout-aside-mobile-mode {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.layout-scrollbar { .layout-scrollbar {
@extend .el-scrollbar; @extend .el-scrollbar;
padding: 15px; padding: 15px;

View File

@ -747,6 +747,11 @@
// 默认样式修改 // 默认样式修改
.el-menu { .el-menu {
border-right: none !important; border-right: none !important;
width: 220px;
}
// 修复点击左侧菜单折叠再展开时宽度不跟随问题
.el-menu--collapse {
width: 64px !important;
} }
.el-menu-item, .el-menu-item,
.el-submenu__title { .el-submenu__title {
@ -886,6 +891,9 @@
color: set-color(primary); color: set-color(primary);
background-color: set-color(primary-light-9); background-color: set-color(primary-light-9);
} }
.el-dropdown-menu .el-dropdown-menu__item {
white-space: nowrap;
}
/* Steps 步骤条 /* Steps 步骤条
------------------------------- */ ------------------------------- */