vue-admin
vue-admin copied to clipboard
Disable the sidebar for the specific view [documentation request]
Hello,
How can i disable the sidebar for specific view? I could not find any documentation about this.
Thanks.
Yes, sidebar can be hidden by setting app.sidebar.hidden
to true
.
I just commit my changes to export this functionality
Now you can hide sidebar by using these codes.
import action from vuex
import { mapActions } from 'vuex'
and
methods: {
...mapActions([
'toggleSidebar'
]),
// your methods
}
then call toggleSidebar
with param {hidden: true}
to hide sidebar.
this.toggleSidebar({hidden: true})
it just hide for sidebar area but sidebar ui is not hide. I add this ---> state.sidebar.opened = !config.hidden .
client\store\modules\app.js
const mutations = {
[types.TOGGLE_DEVICE] (state, device) {
state.device.isMobile = device === 'mobile'
state.device.isTablet = device === 'tablet'
},
[types.TOGGLE_SIDEBAR] (state, config) {
if (state.device.isMobile && config.hasOwnProperty('opened')) {
state.sidebar.opened = config.opened
} else {
state.sidebar.opened = true
}
if (config.hasOwnProperty('hidden')) {
state.sidebar.hidden = config.hidden
---> state.sidebar.opened = !config.hidden
}
},
[types.SWITCH_EFFECT] (state, effectItem) {
for (let name in effectItem) {
state.effect[name] = effectItem[name]
}
}
}