Browse Source

菜单不隐藏

newMaster
1747191978@qq.com 4 months ago
parent
commit
74139e2384
  1. 2
      acupuncture-前台/src/assets/styles/sidebar.scss
  2. 28
      acupuncture-前台/src/layout/components/AppMain.vue
  3. 4
      acupuncture-前台/src/layout/index.vue
  4. 62
      acupuncture-前台/src/store/modules/app.js

2
acupuncture-前台/src/assets/styles/sidebar.scss

@ -187,7 +187,7 @@
// mobile responsive
.mobile {
.main-container {
margin-left: 0px;
margin-left: $base-sidebar-width;
}
.sidebar-container {

28
acupuncture-前台/src/layout/components/AppMain.vue

@ -10,36 +10,36 @@
</template>
<script>
import iframeToggle from "./IframeToggle/index"
import iframeToggle from "./IframeToggle/index";
export default {
name: 'AppMain',
name: "AppMain",
components: { iframeToggle },
computed: {
cachedViews() {
return this.$store.state.tagsView.cachedViews
return this.$store.state.tagsView.cachedViews;
},
key() {
return this.$route.path
}
return this.$route.path;
},
},
watch: {
$route() {
this.addIframe()
}
this.addIframe();
},
},
mounted() {
this.addIframe()
this.addIframe();
},
methods: {
addIframe() {
const {name} = this.$route
const { name } = this.$route;
if (name && this.$route.meta.link) {
this.$store.dispatch('tagsView/addIframeView', this.$route)
}
}
}
this.$store.dispatch("tagsView/addIframeView", this.$route);
}
},
},
};
</script>
<style lang="scss" scoped>
@ -58,7 +58,7 @@ export default {
.hasTagsView {
.app-main {
/* 84 = navbar + tags-view = 50 + 34 */
min-height: calc(100vh - 84px);
min-height: calc(100vh - 50px);
}
.fixed-header + .app-main {

4
acupuncture-前台/src/layout/index.vue

@ -4,11 +4,11 @@
class="app-wrapper"
:style="{ '--current-color': theme }"
>
<div
<!-- <div
v-if="device === 'mobile' && sidebar.opened"
class="drawer-bg"
@click="handleClickOutside"
/>
/> -->
<sidebar v-if="!sidebar.hide" class="sidebar-container" />
<div
:class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }"

62
acupuncture-前台/src/store/modules/app.js

@ -1,66 +1,68 @@
import Cookies from 'js-cookie'
import Cookies from "js-cookie";
const state = {
sidebar: {
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
opened: Cookies.get("sidebarStatus")
? !!+Cookies.get("sidebarStatus")
: true,
withoutAnimation: false,
hide: false
hide: false,
},
device: 'desktop',
size: Cookies.get('size') || 'medium'
}
device: "desktop",
size: Cookies.get("size") || "medium",
};
const mutations = {
TOGGLE_SIDEBAR: state => {
TOGGLE_SIDEBAR: (state) => {
if (state.sidebar.hide) {
return false;
return true;
}
state.sidebar.opened = !state.sidebar.opened
state.sidebar.withoutAnimation = false
state.sidebar.opened = true;
state.sidebar.withoutAnimation = true;
if (state.sidebar.opened) {
Cookies.set('sidebarStatus', 1)
Cookies.set("sidebarStatus", 1);
} else {
Cookies.set('sidebarStatus', 0)
Cookies.set("sidebarStatus", 1);
}
},
CLOSE_SIDEBAR: (state, withoutAnimation) => {
Cookies.set('sidebarStatus', 0)
state.sidebar.opened = false
state.sidebar.withoutAnimation = withoutAnimation
Cookies.set("sidebarStatus", 1);
state.sidebar.opened = true;
state.sidebar.withoutAnimation = false;
},
TOGGLE_DEVICE: (state, device) => {
state.device = device
state.device = device;
},
SET_SIZE: (state, size) => {
state.size = size
Cookies.set('size', size)
state.size = size;
Cookies.set("size", size);
},
SET_SIDEBAR_HIDE: (state, status) => {
state.sidebar.hide = status
}
}
state.sidebar.hide = status;
},
};
const actions = {
toggleSideBar({ commit }) {
commit('TOGGLE_SIDEBAR')
commit("TOGGLE_SIDEBAR");
},
closeSideBar({ commit }, { withoutAnimation }) {
commit('CLOSE_SIDEBAR', withoutAnimation)
commit("CLOSE_SIDEBAR", withoutAnimation);
},
toggleDevice({ commit }, device) {
commit('TOGGLE_DEVICE', device)
commit("TOGGLE_DEVICE", device);
},
setSize({ commit }, size) {
commit('SET_SIZE', size)
commit("SET_SIZE", size);
},
toggleSideBarHide({ commit }, status) {
commit('SET_SIDEBAR_HIDE', status)
}
}
commit("SET_SIDEBAR_HIDE", status);
},
};
export default {
namespaced: true,
state,
mutations,
actions
}
actions,
};

Loading…
Cancel
Save