Cannot switch custom layouts dynamically
[issue link]I want to switch the layout by a button, when I press the button, I’m going to put the state in localStorage,e.g localStorage.setItem(‘themeFlag’,true). then, I’ll get the state in about.vue, but localStorage is not defined,e.g
export default{ layout: (function(){ let themeFlag = localStorage.getItem('themeFlag') return themeFlag ? 'vertical':'horizontal' }()) }
Then I tried another method, e.g
let themeFlag = '' export default{ mouted(){ themeFlag = localStorage.getItem('themeFlag') }, layout:(function(){ return themeFlag ? 'vertical':'horizontal' }()) }
but, in layout, themeFlag is an empty string. I’ve tried use vuex store, but in the layou, I still can’t get the themeFlag.And finally, I found that layout rendered before beforeCreate.
So, I’m going to set the layout dynamically?
thanks.