Achievement effect: Click the button to switch the width of the left menu.
I have now used Vuex to store a field IsOpen, and then both the nav component and the menu component have obtained the initial value of the field, and they also switch when the nav component button is clicked. The value of IsOpen, but the class name that changes the width is not switched.
This is the code for nav formation:
This is the code of the menu component:
import { mapGetters } from 'vuex'
export {
}
在仓库的 getters 文件里面写切换样式的代码
请仔细阅读vuex文档
你可以直接将vuex的数据绑定到你的标签上